Skip to main content
Browse Documentation

List roles

Created by Alex Pop, last updated 07 Aug 2020

Role resources can be retrieved as a paged list by passing an optional PageOptions object as an argument.

list(options?: PageOptions): Promise<PagedList<Role>>

Returns

A Promise that will resolve with a PagedList that contains an array of Role objects.

Example

client.roles.list({
        pageIndex: 1, 
        pageSize: 5
  })
  .then(result => {      
    console.log('API call result: ', result);              
  })
  .catch(error => {
    console.log('API call error: ', error);      
});

Validations

Project does not exist

Roles are project specific. If you attempt to list roles in a project which does not exist you will get the following response.

{
    "logId": "00000000-0000-0000-0000-000000000000",
    "message": "There are validation errors listing the roles",
    "data": [
        {
            "field": "projectId",
            "message": "The project does not exist"
        }
    ],
    "type": "Validation"
}

Insufficient permissions to list roles

In order to list roles you must be a member of the "System Administrators" user group. If you do not have permission to list roles you will get the following response.

{
    "logId": "00000000-0000-0000-0000-000000000000",
    "message": "There are validation errors listing the roles",
    "data": [
        {
            "message": "Access denied"
        }
    ],
    "type": "Validation"
}