Roles

See the roles in your organization and add or revoke roles.


Retrieve a User's Roles and Privileges

GET /users/{id}/roles

Retrieve a specific user's roles and privileges by user ID. 

Retrieve a User's Roles and Privileges Path Parameters

Id
The id associated with a specific user.

Retrieve a User's Roles and Privileges Response Parameters

idThe unique identifier of the role.
nameThe name of the role.
keyThe unique key associated with the role: default-user, admin, or org-admin.
active
descriptionA description of the role.
features
An object containing the features associated with the role.
privileges
A object containing the privileges associated with the role.
hide

Retrieve a User's Roles and Privileges Example Request

curl -X GET \
  https://api.cloud-elements.com/elements/api-v2/users/12435/roles \
  -H 'authorization: User sAfK7LJGNz5ZHcNrvdJvLI=f03WbTbH6aRKc0HJ3oOIi, Organization 58168435e3b9959a929eb04b6218b9a2' \ \
  -H 'Content-Type:application/json' \

Retrieve a User's Roles and Privileges Example Response

[  
  {  
    "id":16339,
    "name":"Default User",
    "key":"default-user",
    "active":true,
    "description":"Default User",
    "features":[  

    ],
    "privileges":[  

    ],
    "hide":false
  },
  {  
    "id":15,
    "name":"Account",
    "key":"admin",
    "active":true,
    "description":"Account Administrator",
    "features":[  

    ],
    "privileges":[  

    ],
    "hide":false
  }
]


Revoke a Role from a User

DELETE /users/{userId}/roles/{roleKey}

Revoke a role assigned to a user. 

Revoke a Role from a User Path Parameters

Id
The id associated with a specific user.
roleKeyThe unique key associated with the role to revoke: default-user, admin, or org-admin.

Revoke a Role from a User Example Request

curl -X DELETE \
  https://api.cloud-elements.com/elements/api-v2/users/12435/roles/admin \
  -H 'authorization: User sAfK7LJGNz5ZHcNrvdJvLI=f03WbTbH6aRKc0HJ3oOIi, Organization 58168435e3b9959a929eb04b6218b9a2' \ \
  -H 'Content-Type:application/json' \

Revoke a Role from a User Example Response

The response is empty. You can confirm that you revoked the role with GET /users/{id}/roles

Assign a Role to a User

PUT /users/{userId}/roles/{roleKey}

Assign a role to a user. 

Assign a Role to a User Path Parameters

userId
The id associated with a specific user.
roleKeyThe unique key associated with the role: default-user, admin, or org-admin.

Assign a Role to a User Example Request

curl -X PUT \
  https://api.cloud-elements.com/elements/api-v2/users/12435/roles/admin \
  -H 'authorization: User sAfK7LJGNz5ZHcNrvdJvLI=f03WbTbH6aRKc0HJ3oOIi, Organization 58168435e3b9959a929eb04b6218b9a2' \ \
  -H 'Content-Type:application/json' \

Assign a Role to a User Example Response

[  
  {  
    "id":16339,
    "name":"Default User",
    "key":"default-user",
    "active":true,
    "description":"Default User",
    "features":[  

    ],
    "privileges":[  

    ],
    "hide":false
  },
  {  
    "id":15,
    "name":"Account",
    "key":"admin",
    "active":true,
    "description":"Account Administrator",
    "features":[  

    ],
    "privileges":[  

    ],
    "hide":false
  }
]