Update Role

This endpoint updates the Role fields specified in the body.

Request

To update one or more specific attributes of a Role please make a PATCH request to the following URL:

HTTP MethodURL
PATCHhttps://industrial.api.ubidots.com/api/v2.0/roles/<role_label>

Path Parameters

ParameterTypeDescription
role_labelStringThe id or username of the User, username should use the prefix ~

Query Parameters

ParameterTypeUseDescription
tokenStringAuthenticationAuthorization Token can optionally be sent as a query parameter.

Body Parameters

ParameterTypeRequired?Default Value
labelStringNorole name
nameStringYesN/A (Required)
descriptionStringNo""
permissionsListYesN/A (Required)

Header

ParameterRequired?Description
X-Auth-TokenYesAuthentication Token of account
Content-TypeYesContent type of body: String (application/json)
$ curl -X PATCH 'https://industrial.api.ubidots.com/api/v2.0/roles/dashboards-viewer' \
 -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"
        },
    ] 
}'
{
  "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."
}

Response

Returns a Role Object of the updated Role