To create a new Role please make a POST request to the following URL:
HTTP Method URL POST https://industrial.api.ubidots.com/api/v2.0/roles/
Parameter Type Use Description token String Authentication Authorization Token can optionally be sent as a query parameter.
Parameter Type Required? Default Value label String No role namename String Yes N/A (Required) description String No ""permissions Lists Yes N/A (Required)
Parameter Required? Description X-Auth-Token Yes Authentication Token of accountContent-Type Yes Content type of body: String (application/json)
cURL(Request)
$ curl -X POST 'https://industrial.api.ubidots.com/api/v2.0/roles/' \
-H 'Content-Type: application/json' \
-H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73' \
-d '{
"name": "Dashboards Viewer Clone",
"permissions": [
{
"label": "view_dashboard",
"name": "Permission to view a Dashboard.",
"model": "dashboard"
},
{
"label": "view_widget",
"name": "Permission to view a Widget.",
"model": "dashboard"
},
]
}'
200 OK 400 Bad Request 401 Unauthorized
{
"url": "https://industrial.api.ubidots.com/api/v2.0/roles/dashboards-viewer-clone",
"label": "dashboards-viewer-clone",
"name": "Dashboards Viewer Clone",
"description": "",
"permissions": [
{
"label": "view_dashboard",
"name": "Permission to view a Dashboard.",
"model": "dashboard"
},
{
"label": "view_widget",
"name": "Permission to view a Widget.",
"model": "dashboard"
},
],
"createdAt": "2023-03-07T13:58:18.605688Z",
"isActive": true,
"permissionsCount": 2
}{
"code": 400001,
"message": "Validation Error.",
"detail": {
....
}
}{
"code": 401001,
"message": "Authentication credentials were not provided.",
"detail": "Authentication credentials were not provided."
}
Returns a Role Object of the Role created.