Usergroups API Example Usage

Usergroups API Endpoints

The Usergroups API allows you to manage user groups in your store. This guide provides examples for each endpoint with sample requests and responses.

Base URL: https://www.venddor.com.br/api
GET /usergroups

Retrieves a list of all user groups.

Example Request

curl -X GET 'https://www.venddor.com.br/api/usergroups'
Note: This endpoint returns all user groups in your store. User groups can be used to assign specific permissions to administrators or customers.
GET /usergroups/:id

Retrieves details of a specific user group by its ID.

Path Parameters

Parameter Type Description
id* integer The unique identifier of the user group

Example Request

curl -X GET 'https://www.venddor.com.br/api/usergroups/3'
Info: This example retrieves the user group with usergroup_id=3.
POST /usergroups

Creates a new user group in the system.

Request Fields

Required fields: type, status

Available fields: status, type, usergroup

Response Status Codes

Status Code Description
201 Created User group created successfully
400 Bad Request Invalid request parameters

Example Request

curl --header 'Content-type: text/plain' -X POST 'https://www.venddor.com.br/api/usergroups' --data-binary 'type=A&status=D&usergroup=Managers'

This example creates a new administrator group called Managers. The status of the user group is set to Disabled.

Example Response

{
  "usergroup_id": 5
}
Tip: The response includes the ID of the newly created user group, which you can use to reference this group in future API calls.
PUT /usergroups/:id

Updates an existing user group with new properties.

Path Parameters

Parameter Type Description
id* integer The unique identifier of the user group to update

Required Fields

type, status

Available Fields

status, type, usergroup

Example Request

curl --header 'Content-type: text/plain' -X PUT 'https://www.venddor.com.br/api/usergroups/5' --data-binary 'type=A&status=A'

This example updates the status of the user group with usergroup_id=5 (the "Managers" group in our case) to Active.

Example Response

{
  "usergroup_id": 5
}
DELETE /usergroups/:id

Deletes a specific user group from the system.

Path Parameters

Parameter Type Description
id* integer The unique identifier of the user group to delete

Response Status Codes

Status Code Description
204 No Content User group deleted successfully
400 Bad Request User group couldn't be deleted
404 Not Found User group doesn't exist

Example Request

curl -X DELETE 'https://www.venddor.com.br/api/usergroups/5'

This example deletes the user group with usergroup_id=5.

Warning: Deleting a user group will remove all associated permissions. Users that were in this group will not lose access to the system, but they may lose specific permissions that were granted by this group.