younifyd
Menu

Create Shares

Create Multiple Shares

POST/shares

Use it in a workflow

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

Primary key of the share;

namestring

Custom (optional) name for the share.

collectionstring

Collection in which the current item is shared. Many-to-one to Collections.

itemstring

Primary key of the item that's shared.

rolestring (uuid)

Role of which the share will inherit the permissions. Many-to-one to shares.

passwordstring (hash)

Optional password that's required to view this shared item.

user_createdstring (uuid)

Reference to the user who created this share. Many-to-one to Users.

date_createdstring (date-time)

When the share was created.

date_startstring (date-time)

Optional timestamp that controls from what date/time the shared item can be viewed.

date_endstring (date-time)

Optional timestamp that controls until what date/time the shared item can be viewed.

times_usedinteger

The number of times the shared item has been viewed.

max_usesinteger

The maximum number of times the shared item can be viewed.

json
{
  "data": [
    {
      "id": "3a606c3e-9d4d-4556-b7bb-f00860613da3",
      "name": "My Share",
      "collection": "articles",
      "item": "1",
      "role": "2b34fba4-a6cb-49f4-a070-2daee7ac44f0",
      "password": "**********",
      "user_created": "b13072b7-73e9-4904-89e0-34aaf4403766",
      "date_created": "2023-01-25T19:16:49.009Z",
      "date_start": "2023-01-26T17:00:00.000Z",
      "date_end": "2023-01-28T17:00:00.000Z",
      "times_used": 0,
      "max_uses": 15
    }
  ]
}

Response

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

dataarray<object>
idstring (uuid)

Primary key of the share;

namestring

Custom (optional) name for the share.

collectionstring

Collection in which the current item is shared. Many-to-one to Collections.

itemstring

Primary key of the item that's shared.

rolestring (uuid)

Role of which the share will inherit the permissions. Many-to-one to shares.

passwordstring (hash)

Optional password that's required to view this shared item.

user_createdstring (uuid)

Reference to the user who created this share. Many-to-one to Users.

date_createdstring (date-time)

When the share was created.

date_startstring (date-time)

Optional timestamp that controls from what date/time the shared item can be viewed.

date_endstring (date-time)

Optional timestamp that controls until what date/time the shared item can be viewed.

times_usedinteger

The number of times the shared item has been viewed.

max_usesinteger

The maximum number of times the shared item can be viewed.

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": "3a606c3e-9d4d-4556-b7bb-f00860613da3",
      "name": "My Share",
      "collection": "articles",
      "item": "1",
      "role": "2b34fba4-a6cb-49f4-a070-2daee7ac44f0",
      "password": "**********",
      "user_created": "b13072b7-73e9-4904-89e0-34aaf4403766",
      "date_created": "2023-01-25T19:16:49.009Z",
      "date_start": "2023-01-26T17:00:00.000Z",
      "date_end": "2023-01-28T17:00:00.000Z",
      "times_used": 0,
      "max_uses": 15
    }
  ],
  "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?