younifyd
Menu

Update Relation

Update a Relation

PATCH/relations/{id}

Use it in a workflow

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

Request

Path parameters

idintegerrequired

Identifier for the object.

Query parameters

fieldsarray<string>

Control what fields are being returned in the object.

metastring

What metadata to return in the response.

Request body

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

collection_manystring

Collection that has the field that holds the foreign key.

collection_onestring

Collection on the _one_ side of the relationship.

field_manystring

Foreign key. Field that holds the primary key of the related collection.

field_onestring

Alias column that serves as the _one_ side of the relationship.

junction_fieldstring

Field on the junction table that holds the primary key of the related collection.

json
{
  "collection_many": "string",
  "collection_one": "string",
  "field_many": "string",
  "field_one": "books",
  "junction_field": "string"
}

Response

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

dataobject
idinteger

Unique identifier for the relation.

many_collectionstring

Collection that has the field that holds the foreign key.

many_fieldstring

Foreign key. Field that holds the primary key of the related collection.

one_collectionstring

Collection on the _one_ side of the relationship.

one_fieldstring

Alias column that serves as the _one_ side of the relationship.

one_collection_fieldstring
one_allowed_collectionsarray<string>
junction_fieldstring

Field on the junction table that holds the many field of the related relation.

sort_fieldstring
one_deselect_actionstring
json
{
  "data": {
    "id": 1,
    "many_collection": "directus_activity",
    "many_field": "user",
    "one_collection": "directus_users",
    "one_field": null,
    "one_collection_field": "string",
    "one_allowed_collections": [
      "string"
    ],
    "junction_field": null,
    "sort_field": "string",
    "one_deselect_action": "string"
  }
}

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

Was this page helpful?