Skip to main content

Access Roles

Overview

Access roles are sets of permissions that are assigned to users.

They limit users' read and write access on endpoints.

Get Access Roles

Returns data from all access roles.

GET /accessroles

Endpoint URL

https://www.cotalker.com/api/v2/accessroles

Headers

HeaderDescriptionRequiredValues
AuthorizationSends your access token to make an API request.
Click here to see how to obtain an access token.
RequiredBearer $ACCESS_TOKEN
AdminGrants access to the endpoint.Requiredtrue

Query Parameters

ParameterDescriptionTypeRequiredNotes
limitLimits the amount of access roles returned in the response.numberOptionalBy default, the limit is set to 10.
pageMakes the response display data from the indicated page number.numberOptionalBest used in combination with the "limit" parameter.
countAdds the counter field with the total amount of access roles.booleanOptional
isActiveReturns access roles according to their accessroles.active status.stringOptionalOptions are: all, true, false
idsReturns access roles with the indicated ObjectIds in their accessroles._id field.ObjectId<COTAccessRole>[ ]Optional
searchReturns access roles that match the keyword. Searches through the values of accessroles.name, accessroles.permissions, and accessroles.description fields.stringOptionalSee COTAccessRole for data model details.
debugAdds the debug field with error notifications and query values.stringOptionalOption: true

Request Sample

Request returns all access roles:

curl --location --request GET 'https://www.cotalker.com/api/v2/accessroles' \
--header 'Admin: true' \
--header 'Authorization: Bearer $ACCESS_TOKEN'

Response Sample

Responses follow the COTAccessRole data model.


Get an Access Role by Id

Returns the access role indicated by the Id.

GET /accessroles/{id}

Endpoint URL

https://www.cotalker.com/api/v2/accessroles/{id}

Path Parameters

ParameterDescriptionTypeRequiredNotes
idThe ObjectId of the access role that is to be returned.ObjectId<COTAccessRole>Required

Headers

HeaderDescriptionRequiredValues
AuthorizationSends your access token to make an API request.
Click here to see how to obtain an access token.
RequiredBearer $ACCESS_TOKEN
AdminGrants administrative access to view the access role.Requiredtrue

Query Parameters

ParameterDescriptionTypeRequiredNotes
debugAdds the debug field with error notifications.stringOptionalOption: true

Request Sample

curl --location --request GET 'https://www.cotalker.com/api/v2/accessroles/619648a6f27b4eb1a9e319ba' \
--header 'Admin: true' \
--header 'Authorization: Bearer $ACCESS_TOKEN'

Response Sample

The response follows the COTAccessRole data model.


Create a New Access Role

Creates a new access role within the company.

POST /accessroles

Endpoint URL

https://www.cotalker.com/api/v2/accessroles

Headers

HeaderDescriptionRequiredValues
AuthorizationSends your access token to make an API request.
Click here to see how to obtain an access token.
RequiredBearer $ACCESS_TOKEN
AdminGrants administrative access to create an access role.Requiredtrue
Content-TypeSets the body's format.Requiredapplication/json

Query Parameters

ParameterDescriptionTypeRequiredNotes
debugAdds the debug field with error notifications.stringOptionalOption: true

Request Body

Only required fields are listed below. For a complete schema description, please go to the COTAccessRole data model. Unrequired fields that are not submitted are either filled in automatically or left blank.

ElementDescriptionTypeRequiredNotes
nameIndicates the access role's name.stringRequired
permissionsSet of permissions assigned to the access role.string[ ]RequiredList of default permissions

Request Sample

Access role created with the minimum required fields:

curl --location --request POST 'https://www.cotalker.com/api/v2/accessroles' \
--header 'Admin: true' \
--header 'Authorization: Bearer $ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "audit",
"permissions": [
"admin-access"
]
}'

Response Sample

Go to COTAccessRole for a complete description of the response.

{
"active": true,
"permissions": [
"admin-access"
],
"_id": "619648a6f27b4eb1a9e319ba",
"name": "audit",
"company": "6196489edb1ac3d5da55e198",
"__v": 0
}

Update an Access Role

Updates, edits, or adds information to an existing access role.

PATCH /accessroles/{id}

Endpoint URL

https://www.cotalker.com/api/v2/accessroles/{id}

Path Parameters

ParameterDescriptionTypeRequiredNotes
idThe ObjectId of the access role that is to be modified.ObjectId<COTAccessRole>Required

Headers

HeaderDescriptionRequiredValues
AuthorizationSends your access token to make an API request.
Click here to see how to obtain an access token.
RequiredBearer $ACCESS_TOKEN
AdminGrants administrative access to modify the access role.Requiredtrue
Content-TypeSets the body's format.Requiredapplication/json

Query Parameters

ParameterDescriptionTypeRequiredNotes
debugAdds the debug field with error notifications.stringOptionalOption: true

Request Body

Only the fields that are being updated or added are required to be put into the body. For a complete schema description, please go to the COTAccessRole data model.

Request Sample

curl --location --request PATCH 'https://www.cotalker.com/api/v2/accessroles/619648a6f27b4eb1a9e319ba' \
--header 'Admin: true' \
--header 'Authorization: Bearer $ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
"description": "Grants auditors read-only permissions to specific endpoints.",
"permissions": ["admin-access", "admin-groups-read"]
}'

Response Sample

Go to COTAccessRole for a complete description of the response.

{
"active": true,
"permissions": [
"admin-access",
"admin-groups-read"
],
"_id": "619647ffda52400007d7ffdc",
"name": "audit",
"company": "6136968b580aaf2b0e49d844",
"__v": 2,
"description": "Grants auditors read-only permissions to specific endpoints."
}