This endpoint updates all fields of the Role specified in the body.
Updating a Single Field
To update only a single field of a User, please use the PATCH method with the parameters that need to be changed.
Request
To update all attributes of a specific Role please make a PUT request to the following URL:
HTTP Method | URL |
---|---|
PUT | https://industrial.api.ubidots.com/api/v2.0/roles/<role_label> |
Path Parameters
Parameter | Type | Description |
---|---|---|
role_label | String | The id or username of the User, username should use the prefix ~ |
Query Parameters
Parameter | Type | Use | Description |
---|---|---|---|
token | String | Authentication | Authorization Token can optionally be sent as a query parameter. |
Body Parameters
Parameter | Type | Required? | Default Value |
---|---|---|---|
label | String | No | role name |
name | String | Yes | N/A (Required) |
description | String | No | "" |
permissions | List | Yes | N/A (Required) |
Header
Parameter | Required? | Description |
---|---|---|
X-Auth-Token | Yes | Authentication Token of account |
Content-Type | Yes | Content type of body: String (application/json) |
$ curl -X PUT 'https://industrial.api.ubidots.com/api/v2.0/roles/dashboards-viewer' \
-H 'Content-Type: application/json' \
-H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73' \
-d '{
"name": "Ubidots",
"label": "ubidots",
"permissions": [
{
"label": "view_dashboard",
"name": "Permission to view a Dashboard.",
"model": "dashboard"
},
{
"label": "view_widget",
"name": "Permission to view a Widget.",
"model": "dashboard"
},
]
}'
{
"url": "https://industrial.api.ubidots.com/api/v2.0/roles/ubidots",
"label": "ubidots",
"name": "Ubidots",
"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."
}
Response
Returns a Role Object of the updated Role