Roles endpoint enables you to get role information and manage roles in Silverbucket's database. Endpoint's URL is:
https://<your_environment_url>/customer-api/1.0/roles/
When calling /roles/ endpoint without parameters you will get all the roles from database. Example response:
{
"count": 1,
"csvUrl": "/customer-api/1.0/roles/?csv=true",
"itemsPerPage": 500,
"excelUrl": "/customer-api/1.0/roles/?excel=true",
"next": null,
"current": 1,
"lastPage": 1,
"data": [
{
"id": 1,
"name": "Specialist",
"is_default": true,
"cost_price": null,
"hourly_rate": null,
"is_active": true,
"currency": 1},
],
"previous": null
}
You can add role's with POST method to the same URL than get. POST body contains new role's data in JSON format. Successful call will give response code 201 and return the newly created role's JSON. Minimum JSON for adding a role is:
{
"name": "<string: unique>",
"currency": <currency_id>
}