Skip to main content
May 11, 2022 10:49 AM UTC
Solved

how to attach usergroup to one organisation using API

Iam creating users, usergroups, organisation in runtime. But how to attach usergroup to one organisation using API or service ? 

AP_9587236_0-1652266141333.png

 

May 13, 2022 2:07 PM UTC

@AP_9587236  You can use REST API to trigger the service externally or use ThingWorx UI and add a helper service to a thing.

And you need the 'AddMember' service.

 

I've shot a quick sample video showcasing these two approaches.

I only noticed that the question was about adding groups, not users, after I've filmed the video, but that would be pretty much the same, besides changinf the "type" param value to "Group"

 

https://www.youtube.com/watch?v=oh0lfq0TYSE

3 replies

May 11, 2022 2:53 PM UTC

Hi @AP_9587236 

 

If you tack this to the end of your ThingWorx url, you will see all the services that are exposed:  /Organizations/Everyone/ServiceDefinitions/

 

Note this is for the Everyone organization, so you may need to change it.

 

Regards.

 

--Sharon

May 12, 2022 11:40 AM UTC

Yes, I am seeing these services. But how to call these services inside code ? This is not available in snippet also. When i tried this code, it is not working.
AddOrganizationalUnit({
parentName: "Testing Organization",
name: "TestingUnit"
});

And Iam not seeing Adding usergroup service in this list. 

AP_9587236_0-1652355938934.png

 

May 13, 2022 2:07 PM UTC

@AP_9587236  You can use REST API to trigger the service externally or use ThingWorx UI and add a helper service to a thing.

And you need the 'AddMember' service.

 

I've shot a quick sample video showcasing these two approaches.

I only noticed that the question was about adding groups, not users, after I've filmed the video, but that would be pretty much the same, besides changinf the "type" param value to "Group"

 

https://www.youtube.com/watch?v=oh0lfq0TYSE