A role is similar to an ordinary user. You can assign tasks to a role and use it in your workflows. Each role participant receives a task in their Inbox, and when at least one of them approves or declines the task, it is forwarded to the next stage.
You can find additional information about roles in the help section.
This method returns a list of roles in your organization.
GET https://api.pyrus.com/v4/roles
{ "roles": [ { "id": 32568, "name": "Accountant", "banned": false, "member_ids": [ 1233, 1731, 2384 ] }, { "id": 13355, "name": "Managers", "banned": false, "member_ids": [ 2384, 1346, 4444, 3460 ] } ] }
curl -X GET \ 'https://api.pyrus.com/v4/roles' \ -H 'Authorization: Bearer <YOUR_ACCESS_TOKEN>' \ -H 'Content-Type: application/json'
This method creates a role in the user's organization.
POST https://api.pyrus.com/v4/roles
{ "name": "TechSupport", "member_add": [ 1732, 4487 ] }
{ "id": 9364, "name": "TechSupport", "banned": "false" "member_ids": [ 1732, 4487 ] }
curl -X POST \ https://api.pyrus.com/v4/roles \ -H 'Authorization: Bearer <YOUR_ACCESS_TOKEN>' \ -H 'Content-Type: application/json' \ -d '{ "name": "TechSupport", "member_ids": [ 1732, 4487 ] }'
name | Role name. |
member_add | Role members. An array of person IDs. |
This method updates a role.
PUT https://api.pyrus.com/v4/roles/9364
{ "name": "InternalTechSupport", "member_add": [ 3796 ], "member_remove": [ 1732 ], "banned": false }
{ "id": 9364, "name": "InternalTechSupport", "banned": "false" "member_ids": [ 3796, 4487 ] }
curl -X PUT \ https://api.pyrus.com/v4/roles/9364 \ -H 'Authorization: Bearer <YOUR_ACCESS_TOKEN>' \ -H 'Content-Type: application/json' \ -d '{ "name": "InternalTechSupport", "member_add": [ 3796 ], "member_remove": [ 1732 ], "banned": false }'
name | Role name. |
member_add | Added role members. An array of person IDs. |
member_remove | Removed role members. An array of person IDs. |
banned | Ban/unban role. |