Shares
List Shares
List all shares that exist in Directus.
Query Parameters
Control what fields are being returned in the object.
A limit on the number of objects that are returned.
How many items to skip when fetching data.
What metadata to return in the response.
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. You can also use a ?
to sort randomly.
Select items in collection by given conditions.
Filter by items that contain the given search query in one of their fields.
Cursor for use in pagination. Often used in combination with limit.
GET /shares
{
"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": {}
}
Create Multiple Shares
Create multiple new shares.
Query Parameters
Control what fields are being returned in the object.
A limit on the number of objects that are returned.
What metadata to return in the response.
How many items to skip when fetching data.
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. You can also use a ?
to sort randomly.
Select items in collection by given conditions.
Filter by items that contain the given search query in one of their fields.
Request Body
POST /shares
{
"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": {}
}
Delete Multiple Shares
Delete multiple existing shares.
DELETE /shares
Update Multiple Shares
Update multiple shares at the same time.
Query Parameters
Control what fields are being returned in the object.
A limit on the number of objects that are returned.
What metadata to return in the response.
How many items to skip when fetching data.
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. You can also use a ?
to sort randomly.
Select items in collection by given conditions.
Filter by items that contain the given search query in one of their fields.
Request Body
PATCH /shares
{
"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": {}
}
Create a Share
Create a new share.
Query Parameters
Control what fields are being returned in the object.
What metadata to return in the response.
Request Body
POST /shares
{
"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
}
}
Retrieve a Share
List an existing share by primary key.
Query Parameters
Unique identifier of the share.
Control what fields are being returned in the object.
What metadata to return in the response.
GET /shares/{id}
{
"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
}
}
DELETE /shares/{id}
Update a Share
Update an existing share.
Query Parameters
Unique identifier of the share.
Control what fields are being returned in the object.
What metadata to return in the response.
Request Body
PATCH /shares/{id}
{
"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
}
}
Authenticate a Share
Authenticate as a share user. Shares work by returning a token, as it is the case with the regular login endpoint. These tokens are limited to a permissions set that only allows access to the item that was shared, and any relationally linked items that that associated role has access to. This means that all regular endpoints can be used with the token returned by this endpoint.
Request Body
Primary key of the share you're authenticating against.
Password for the share, if one is configured.
Whether to retrieve the refresh token in the JSON response, or in a httpOnly
cookie.
POST /shares/auth
{
"data": {
"access_token": "eyJhbGciOiJI...",
"expires": 900,
"refresh_token": "yuOJkjdPXMd..."
}
}
Get Share Public Info
Allows unauthenticated users to retrieve information about the share.
Query Parameters
Unique identifier of the share.
GET /shares/info/{id}
{
"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
}
}