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
- Revision Actions
- Role Actions
- Setting Actions
- User Actions
- Utility Actions
Overview
This node is designed to create a new item within a specified collection in a Directus data platform. It allows users to specify the target collection and provide the item data as JSON. This operation is useful for automating content creation, such as adding articles, products, or any custom data entries into Directus collections.
Practical examples include:
- Automatically adding new blog posts to a "articles" collection.
- Creating new product entries in an e-commerce inventory system.
- Inserting user-generated content into a custom collection.
Properties
Name | Meaning |
---|---|
Collection Name | The unique name of the parent collection where the new item will be created. Options are dynamically loaded from available collections. |
Data (JSON) | The partial item object represented in JSON format. This contains the fields and values to set on the new item. |
Output
The node outputs a JSON object representing the newly created item in the specified collection. This output includes all fields returned by the Directus API after creation, typically including the item's unique identifier and any default or computed fields.
If the node supports binary data output, it would represent associated files or media linked to the item, but based on the provided code and properties, this node focuses on JSON data only.
Dependencies
- Requires access to a Directus instance with appropriate permissions to create items.
- Needs an API authentication token or API key credential configured in n8n to authorize requests.
- The node dynamically loads available collections via a method named
getCustomCollections
, so the Directus API must support this endpoint.
Troubleshooting
Common issues:
- Providing an invalid or non-existent collection name will result in errors.
- Malformed JSON in the "Data (JSON)" property can cause parsing failures.
- Insufficient permissions to create items in the specified collection will lead to authorization errors.
Error messages:
- "Collection not found": Verify the collection name is correct and exists in Directus.
- "Invalid JSON data": Check the syntax of the JSON input for errors.
- "Unauthorized" or "Forbidden": Ensure the API credentials have create permissions for the collection.