Move users to a user group via API
For a general introduction to Portal API please refer to this article. The complete technical documentation is available here.
As the context of you XR application becomes more complex and sensitive, you may need to move users from one user group to another to grant or restrict access to certain features. Using the Innoactive Portal API, you can automate this process and streamline your user management workflow.
The API allows you to create, update, and delete user groups, as well as manage users within those groups. To move a user to a different group, you can update the user's group membership.
The starting point is to get the <user-id>
of the users you want to move to the new user group. After being authenticated, you can use this endpoint https://api.innoactive.io/api/users/
and note down the ID of the users you want to move, for this example the target user is Daniel:
Daniel’s <user-id>
is 5.
The ID is a progressive number, so if the users you want to move registered on your org in the same time-frame it is very likely that they will have a sequential ID.
Then you need the <group-id>
of the user group where you want to add new users, you can find the <group-id>
from this endpoint https://api.innoactive.io/api/groups/
Let’s say, for this example that you need to move two users to the user group Team, the <group-id>
of Team is 596.
At this point you can work on the user group with three different requests: GET, POST and DELETE on /api/groups/<group-id>/users/
endpoint.
A GET request simply lists all users part of the group.
A DELETE request remove users for the group - it is required to specify the user ID in this way
/api/groups/<group-id>/users/<user-id>
.A POST request is what you need to add users to the group.
The body of the POST request must contain the user IDs of the users you want to move to the user group. It will look like this:
[<user-id-1>, <user-id-2>]
So, back to our example, if you want to move Daniel and the user who registered right after him, you need to provide a POST request to https://api.innoactive.io/api/groups/596/users/
with this body:
[5, 6]