Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
Hi,
When trying to call CreateDataShape on EntityServices from SystemUser, i get this exception:
"Unable to process import: Not authorized for Create".
If i give the execution permission to the System user on this service, it doen't change anything.
Could someone tell me which specific permissions i need to give to be able to call the CreateDataShape service ?
Thanks for your help.
Hi @cbaurand,
By System User, did you mean user added into Administrators group or what?
If you are trying to execute CreateDataShape service from Resources--Entity Services, it will only create Datashape with name and no fields.
You can write your own service to achieve the same. Please refer below sample code.
var params = {
infoTableName: "myDS" /* STRING */
};
// result: INFOTABLE
var infotable = Resources["InfoTableFunctions"].CreateInfoTable(params);
var newField = new Object();
newField.name = "column1";
newField.baseType = 'STRING';
newField.ordinal = 4;
infotable.AddField(newField);
Resources["EntityServices"].CreateDataShape({
name: "myDS" /* STRING */,
description: undefined /* STRING */,
fields: infotable /* INFOTABLE */,
tags: undefined /* TAGS */
});
System user is the built-in Thingworx System user. This call "Resources["EntityServices"].CreateDataShape" fails with this user.
Are you referring to the in-built OOTB ThingWorx System user? Or is it user created by you and named "SystemUser"?
If it is the in-built OOTB ThingWorx system user, then how you are executing the service from this user thread?
Yes, it's the ThingWorx System user. The service is called by subscription on a property. When the property change, the service is called.
Continuing my investigation, i found this topic:
"https://community.ptc.com/t5/ThingWorx-Developers/Unable-to-create-a-user-via-a-script/td-p/530612".
-> give the design time permission to the System user.
I belived it would be the solution but it isn't!
So wait for any suggestion!