Skip to main content
POST
/
v1
/
access-management
Create Access Role
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    roleName: 'Manager',
    roleData: [
      [
        {path: '/', access: 'Full Access'},
        {path: '/my-team', access: 'Team Data'},
        {path: '/proof-of-work/screenshot', access: 'Own Data'}
      ]
    ]
  })
};

fetch('https://api.trackpilots.com/v1/access-management', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{
  "success": true,
  "statusCode": 200,
  "statusMessage": "Page-level access permissions have been successfully assigned to the role.",
  "error": null,
  "data": {
    "roleId": "c44a66ea-d0ba-4423-9f85-25c68f7aa37b",
    "roleName": "Manager",
    "roleData": [
      {
        "path": "/",
        "access": "Full Access"
      },
      {
        "path": "/my-team",
        "access": "Team Data"
      },
      {
        "path": "/proof-of-work/screenshot",
        "access": "Own Data"
      }
    ]
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
roleName
string
required
Example:

"Manager"

roleData
object[]

Route-wise access configuration defining the permission level granted to this role.

Response

Page-level access permissions have been successfully assigned to the role.

success
boolean
Example:

true

statusCode
integer
Example:

200

statusMessage
string
Example:

"Page-level access permissions have been successfully assigned to the role."

error
object
Example:

null

data
object