This guide demonstrates how to manage user membership in groups through the Venddor API. You'll learn how to view user group memberships, add users to groups, and remove users from groups.
To retrieve information about which groups a user belongs to, use the GET method with the user ID:
Retrieves all user group memberships for the specified user, along with their status in each group.
curl -X GET 'https://www.venddor.com.br/api/users/3/usergroups'
This request returns all groups that the user with user_id=3
is associated with, except those with the Available
status.
Parameter | Description |
---|---|
link_id |
The ID of the link that assigns the user to the group |
usergroup_id |
The ID of the user group |
status |
The user's status in the group |
Code | Status | Description |
---|---|---|
A |
Active | The user is a member of the group |
F |
Available | The user is not a member of the group |
P |
Pending | The user has requested to join the group |
D |
Declined | The user's request to join the group has been declined |
Available
status will not be returned in the response.
To add a user to a group, change their status in the group to Active
:
Updates a user's status in a specific group.
curl --header 'Content-type: text/plain' -X PUT 'https://www.venddor.com.br/api/users/3/usergroups/5' --data-binary 'status=A'
This request adds the user with user_id=3
to the group with usergroup_id=5
by setting their status to Active
.
If the user is successfully added to the group, you will receive the message: Status has been changed
.
Status Code | Description |
---|---|
400 Bad Request |
The user group doesn't exist or you're trying to add a customer to an administrator group |
404 Not Found |
The user doesn't exist |
There are two methods to remove a user from a group:
Method 1: Change the user's status to Available
using the PUT method:
curl --header 'Content-type: text/plain' -X PUT 'https://www.venddor.com.br/api/users/3/usergroups/5' --data-binary 'status=F'
Method 2: Use the DELETE method to remove the user from the group:
curl -X DELETE 'https://www.venddor.com.br/api/users/3/usergroups/5'