younifyd
Menu

Create Presets

Create Multiple Presets

POST/presets

Use it in a workflow

  1. Add a step and choose the Directus connector.
  2. Pick the Create Presets action (under Presets).
  3. Fill in the fields below, then reference the result from later steps as {{createPresets.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>
idinteger

Unique identifier for this single collection preset.

bookmarkstring

Name for the bookmark. If this is set, the preset will be considered a bookmark.

userstring

The unique identifier of the user to whom this collection preset applies.

rolestring

The unique identifier of a role in the platform. If `user` is null, this will be used to apply the collection preset or bookmark for all users in the role.

collectiononeOf

What collection this collection preset is used for.

searchstring

Search query.

layoutstring

Key of the layout that is used.

layout_queryobject

Layout query that's saved per layout type. Controls what data is fetched on load. These follow the same format as the JS SDK parameters.

layout_optionsobject

Options of the views. The properties in here are controlled by the layout.

filtersarray<any>
json
{
  "data": [
    {
      "id": 155,
      "bookmark": "string",
      "user": "63716273-0f29-4648-8a2a-2af2948f6f78",
      "role": "50419801-0f30-8644-2b3c-9bc2d980d0a0",
      "collection": "articles",
      "search": "string",
      "layout": null,
      "layout_query": {
        "cards": {
          "sort": "-published_on"
        }
      },
      "layout_options": {
        "cards": {
          "icon": "account_circle",
          "title": "{{ first_name }} {{ last_name }}",
          "subtitle": "{{ title }}",
          "size": 3
        }
      },
      "filters": [
        null
      ]
    }
  ]
}

Response

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

dataarray<object>
idinteger

Unique identifier for this single collection preset.

bookmarkstring

Name for the bookmark. If this is set, the preset will be considered a bookmark.

userstring

The unique identifier of the user to whom this collection preset applies.

rolestring

The unique identifier of a role in the platform. If `user` is null, this will be used to apply the collection preset or bookmark for all users in the role.

collectiononeOf

What collection this collection preset is used for.

searchstring

Search query.

layoutstring

Key of the layout that is used.

layout_queryobject

Layout query that's saved per layout type. Controls what data is fetched on load. These follow the same format as the JS SDK parameters.

layout_optionsobject

Options of the views. The properties in here are controlled by the layout.

filtersarray<any>
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": 155,
      "bookmark": "string",
      "user": "63716273-0f29-4648-8a2a-2af2948f6f78",
      "role": "50419801-0f30-8644-2b3c-9bc2d980d0a0",
      "collection": "articles",
      "search": "string",
      "layout": null,
      "layout_query": {
        "cards": {
          "sort": "-published_on"
        }
      },
      "layout_options": {
        "cards": {
          "icon": "account_circle",
          "title": "{{ first_name }} {{ last_name }}",
          "subtitle": "{{ title }}",
          "size": 3
        }
      },
      "filters": [
        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?