Role
  • 16 Jun 2022
  • 2 Minutes to read
  • Dark
    Light

Role

  • Dark
    Light

Article summary

Role

You need the Manage Agent & Agent Roles permission to manage roles.

Role JSON Format

Role is represented as simple flat JSON objects with the following keys:

NameTypeDescription
idguidId of the role.
namestringName of the role.
descriptionstringDescription of the role.
typestring"Administrators" and "AllAgents" are the system role types. They cannot be deleted.Allowed values are "Administrators", "AllAgents", "Custom".
agentIdsarrayThe selected agents for this role.If not offered, will use role identifier of "AllAgents" as default.
permissionIdsarrayPermissions assigned to this role.

Get the list of Roles

GET global/roles

  • Parameters:

NameTypeinRequiredDescription
includestringquerynoAllowed values are "agent", "permission".
  • Response:

An array of Role

  • Example

Sample Request:

curl https://api11.comm100.io/v4/global/roles \ 
    -X 'GET' \ 
    -H 'Authorization: Bearer {access_token}' \ 

Response:

HTTP/1.1 200 OK

[
  {
      "id": "c8448a05-ede0-4adc-bb43-6b1ee3977b9c",
      "name": "Pre-sale",
      "description": "Pre-sale role",
      "type": "Custom",
      "agentIds": [
          "3FA2EF45-7D46-EB11-8100-00155D081D0B"
      ],
      "permissionIds": [
          "4,5"
      ]
  }
] 

Get a single Role

GET global/roles/{id}

  • Parameters:

NameTypeinRequiredDescription
includestringquerynoAllowed values are "agent", "permission".
  • Response:

Role

  • Example

Sample Request:

curl https://api11.comm100.io/v4/global/roles/c8448a05-ede0-4adc-bb43-6b1ee3977b9c \ 
    -X 'GET' \ 
    -H 'Authorization: Bearer {access_token}' \ 

Response:

HTTP/1.1 200 OK

{
  "id": "c8448a05-ede0-4adc-bb43-6b1ee3977b9c",
  "name": "Pre-sale",
  "description": "Pre-sale role",
  "type": "Custom",
  "agentIds": [
      "3FA2EF45-7D46-EB11-8100-00155D081D0B"
  ],
  "permissionIds": [
      "4,5"
  ]
} 

Create a new Role

POST global/roles

  • Parameters:

NameTypeinRequiredDescription
namestringbodyyesName of the role.
descriptionstringbodynoDescription of the role.
typestringbodyno"Administrators" and "AllAgents" are the system role types. They cannot be deleted.Allowed values are "Administrators", "AllAgents", "Custom".
agentIdsarraybodynoThe selected agents for this role.If not offered, will use role identifier of "AllAgents" as default.
permissionIdsarraybodynoPermissions assigned to this role.
  • Response:

Role

  • Example

Sample Request:

curl https://api11.comm100.io/v4/global/roles \ 
    -X 'POST' \ 
    -H 'Authorization: Bearer {access_token}' \ 
    -H 'Content-Type: application/json' \ 
    -D '{"name":"Pre-sale","description":"Pre-sale role","type":"Custom"}' 

Response:

HTTP/1.1 201 Created

{
  "id": "c8448a05-ede0-4adc-bb43-6b1ee3977b9c",
  "name": "Pre-sale",
  "description": "Pre-sale role",
  "type": "Custom",
  "agentIds": [
      "3FA2EF45-7D46-EB11-8100-00155D081D0B"
  ],
  "permissionIds": [
      "4,5"
  ]
} 

Update the Role

PUT global/roles/{id}

  • Parameters:

NameTypeinRequiredDescription
namestringbodyyesName of the role.
descriptionstringbodynoDescription of the role.
typestringbodyno"Administrators" and "AllAgents" are the system role types. They cannot be deleted.Allowed values are "Administrators", "AllAgents", "Custom".
agentIdsarraybodynoThe selected agents for this role.If not offered, will use role identifier of "AllAgents" as default.
permissionIdsarraybodynoPermissions assigned to this role.
  • Response:

Role

  • Example

Sample Request:

curl https://api11.comm100.io/v4/global/roles/c8448a05-ede0-4adc-bb43-6b1ee3977b9c \ 
    -X 'PUT' \ 
    -H 'Authorization: Bearer {access_token}' \ 
    -H 'Content-Type: application/json' \ 
    -D '{"name":"Pre-sale","description":"Pre-sale role","type":"Custom"}' 

Response:

HTTP/1.1 200 OK

{
  "id": "c8448a05-ede0-4adc-bb43-6b1ee3977b9c",
  "name": "Pre-sale",
  "description": "Pre-sale role",
  "type": "Custom",
  "agentIds": [
      "3FA2EF45-7D46-EB11-8100-00155D081D0B"
  ],
  "permissionIds": [
      "4,5"
  ]
} 

Remove the Role

DELETE global/roles/{id}

  • Parameters:

No Parameters

  • Response:

No Content

  • Example

Sample Request:

curl https://api11.comm100.io/v4/global/roles/c8448a05-ede0-4adc-bb43-6b1ee3977b9c \ 
    -X 'DELETE' \ 
    -H 'Authorization: Bearer {access_token}' \ 

Response:

HTTP/1.1 204 No Content


Was this article helpful?

What's Next