Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
How do you programmatically refer to a sub-organization in the following example? I want to add a sub-organization to the visibility permissions of an existing Thing. The service snippet looks like the following but there's no information on the requirements or formatting of the "principal" and "principalType" strings.
var params = {
principal: mySubOrganization,
principalType: "Organization"
};
Things["myThing"].AddVisibilityPermission(params);
If I have an organization named “Org” and that organization contains a sub-organization called “Sub”, what should I enter for the "principal" string? Is this the proper form of the property?
mySubOrganizaiton = "Org:Sub";
Next, what is the correct string to use for the "principalType"? I've tried "Organization", "OrganizationUnit", and "Organization Unit" without success.
Lastly, where is this information documented?
Thanks -
Solved! Go to Solution.
You are right with mySubOrganization = "Org:Sub" that's principal, por principalType you should write "OrganizationalUnit"
Documented? I don't remember where I found it or I may did just try/fail.
Documentacion:
You are right with mySubOrganization = "Org:Sub" that's principal, por principalType you should write "OrganizationalUnit"
Documented? I don't remember where I found it or I may did just try/fail.
Documentacion:
Hi Coll,
It is working cool.
Thanks.
Hi Joe,
You can see what options exist for the parameters expected in a given service through the service definitions of that thing.
In your case this is the link where you would find the possible values for the AddVisibilityPermission service parameters
Hi,
This is an example of an Visibility Permission with the help of REST:
instanceURL+"/Thingworx/DataShapes/DataShape1/Services/AddVisibilityPermission?principal="+Organization_Name +"&principalType=Organization&method=post" /* STRING */,
where instanceURL is an input into your service where you can set your hostname(for ex: http://localhost)
and Organization_Name is another input where you can set the organization for which you want to add the Visibility Permission on this entity(in this case the DataShape1 Data Shape), you can either put an input or you have just one organization and don't want to use this for any other visibility permissions you can just type the name of the organization(for ex, if you want to to grant Visibility Permissions on local instance for DataShape1 for an Test_Org organization the request will be: "http://localhost/Thingworx/DataShapes/DataShape1/Services/AddVisibilityPermission?principal=Test_Org&principalType=Organization&method=post" /* STRING */,
Hope this helped,
Adrian
Thanks. The "principalType" must be set to "OrganizationalUnit".
Using "Organization Unit", as the service definition states, will produce an exception. The service definition information is wrong.