younifyd
Menu

Create Roles

Create Multiple Roles

POST/roles

Use it in a workflow

  1. Add a step and choose the Directus connector.
  2. Pick the Create Roles action (under Roles).
  3. Fill in the fields below, then reference the result from later steps as {{createRoles.response.data}}.

Request

Query parameters

fieldsarray<string>

Control what fields are being returned in the object.

limitinteger

A limit on the number of objects that are returned.

metastring

What metadata to return in the response.

offsetinteger

How many items to skip when fetching data.

sortarray<string>

How to sort the returned items. `sort` is a CSV of fields used to sort the fetched items. Sorting defaults to ascending (ASC) order but a minus sign (` - `) can be used to reverse this to descending (DESC) order. Fields are prioritized by their order in the CSV.

filterany

Select items in collection by given conditions.

searchstring

Filter by items that contain the given search query in one of their fields.

Request body

Enter the body as JSON in the step's Body field.

dataarray<object>
idstring (uuid)

Unique identifier for the role.

namestring

Name of the role.

iconstring

The role's icon.

descriptionstring

Description of the role.

parentstring (uuid)

Optional parent role that this role inherits permissions from. Many-to-one to roles.

childrenarray<oneOf>

Nested child roles that inherit this roles permissions. One-to-many to roles. One-to-many to roles.

policiesarray<oneOf>

The policies in this role. Many-to-many to roles.

usersarray<oneOf>

The users in this role. One-to-many to users.

json
{
  "data": [
    {
      "id": "2f24211d-d928-469a-aea3-3c8f53d4e426",
      "name": "Administrator",
      "icon": "verified_user",
      "description": "Admins have access to all managed data within the system by default",
      "parent": "00000000-0000-0000-0000-000000000000",
      "children": [
        null
      ],
      "policies": [
        null
      ],
      "users": [
        null
      ]
    }
  ]
}

Response

Returns 200 with an object. Read it in later steps with {{createRoles.response.data.<field>}}.

dataarray<object>
idstring (uuid)

Unique identifier for the role.

namestring

Name of the role.

iconstring

The role's icon.

descriptionstring

Description of the role.

parentstring (uuid)

Optional parent role that this role inherits permissions from. Many-to-one to roles.

childrenarray<oneOf>

Nested child roles that inherit this roles permissions. One-to-many to roles. One-to-many to roles.

policiesarray<oneOf>

The policies in this role. Many-to-many to roles.

usersarray<oneOf>

The users in this role. One-to-many to users.

metaobject
total_countinteger

Returns the total item count of the collection you're querying.

filter_countinteger

Returns the item count of the collection you're querying, taking the current filter/search parameters into account.

json
{
  "data": [
    {
      "id": "2f24211d-d928-469a-aea3-3c8f53d4e426",
      "name": "Administrator",
      "icon": "verified_user",
      "description": "Admins have access to all managed data within the system by default",
      "parent": "00000000-0000-0000-0000-000000000000",
      "children": [
        null
      ],
      "policies": [
        null
      ],
      "users": [
        null
      ]
    }
  ],
  "meta": {
    "total_count": 0,
    "filter_count": 0
  }
}

Need more? See the Directus guide for connection setup and behaviour shared by every action.

Was this page helpful?