Actions100
- Activity Actions
- Asset Actions
- Authentication Actions
- Collection Actions
- Extension Actions
- Field Actions
- File Actions
- Folder Actions
- Item Actions
- Permission Actions
- Preset Actions
- Relation Actions
- Revisions Actions
- Roles Actions
- Settings Actions
- Users Actions
- Utilities Actions
Overview
The Directus - Item: Update operation allows you to update an existing item (record) in a specified collection within your Directus instance. This is useful for modifying content, metadata, or any field of a record in your database via n8n workflows.
Common scenarios:
- Updating article content in a CMS.
- Modifying user profile data stored in a custom collection.
- Changing the status or properties of an inventory item.
Practical example:
Suppose you have a collection called articles
and want to update the title and body of an article with ID 15
. You can use this node to specify the collection as articles
, the ID as 15
, and provide the new data in JSON format.
Properties
Name | Type | Meaning |
---|---|---|
ID | String | Unique ID of the item (record) to update. |
Collection | Options | The unique name of the parent collection where the item resides. |
Data (JSON) | JSON | Partial item object containing the fields and values to update. |
Output
- The output will be a single object in the
json
field representing the updated item as returned by the Directus API. - The structure of the output matches the schema of the collection being updated, including all fields that were modified and possibly other fields depending on the API response.
Example output:
{
"id": 15,
"title": "Hello world!",
"body": "This is our first article",
"...otherFields": "..."
}
Dependencies
- Directus API: Requires access to a running Directus instance.
- API Credentials: You must configure the
directusApi
credentials in n8n for authentication.
Troubleshooting
Common issues:
- Invalid ID: If the provided ID does not exist in the specified collection, the node will throw an error.
- Malformed Data (JSON): If the
Data (JSON)
property is not valid JSON or does not match the collection's schema, the update will fail. - Insufficient Permissions: The API credentials used must have permission to update items in the target collection.
Error messages and resolutions:
"Cannot find item"
: Check that the ID and collection are correct."Invalid JSON"
: Ensure theData (JSON)
input is properly formatted."Permission denied"
: Verify your Directus API credentials and permissions.