E Roles#

a. Create

#

Creates a new role

POST /roles
import Fragment from '@fragment-dev/ts-node';

const client = new Fragment({
  clientId: process.env['FRAGMENT_CLIENT_ID'],
  clientSecret: process.env['FRAGMENT_CLIENT_SECRET'],
});

const response = await client.roles.create({ role: 'admin' });
Parameters
role
string, required
Name of the role
Response
{
  "data": {
    "id": "role_abc123",
    "role": "admin"
  }
}

b. List

#

Lists all roles for the workspace

GET /roles
import Fragment from '@fragment-dev/ts-node';

const client = new Fragment({
  clientId: process.env['FRAGMENT_CLIENT_ID'],
  clientSecret: process.env['FRAGMENT_CLIENT_SECRET'],
});

const response = await client.roles.list();
Response
{
  "data": [
    {
      "id": "role_abc123",
      "role": "admin"
    }
  ]
}