Directus (flagbit) icon

Directus (flagbit)

Consume Directus API

Overview

The node allows creating multiple items in a specified collection within a Directus data platform. It is useful when you want to batch insert several records at once, for example, importing multiple articles or entries into a content management system. This operation streamlines bulk data creation, saving time compared to creating each item individually.

Practical examples:

  • Importing a list of blog posts with titles and bodies.
  • Adding multiple product entries to an e-commerce catalog simultaneously.

Properties

Name Meaning
Collection Name The unique name of the parent collection where the items will be created.
Data (JSON) A JSON array containing partial item objects to create. Each object represents one new item.

Output

The output contains a json field representing the response from the Directus API after creating the items. This typically includes details about the newly created items such as their IDs and any other fields returned by the API. There is no indication that binary data is output by this node.

Dependencies

  • Requires connection to a Directus instance via its API.
  • Needs an API authentication token or key configured in n8n credentials to authorize requests.
  • The node depends on internal methods and routing logic bundled in the source code (./actions/router, ./methods, etc.) to perform the actual API calls.

Troubleshooting

  • Invalid Collection Name: If the collection name does not exist or is misspelled, the API will return an error. Verify the collection name matches exactly what exists in Directus.
  • Malformed JSON Data: The "Data (JSON)" property must be a valid JSON array of objects. Syntax errors or incorrect formatting will cause failures.
  • Authentication Errors: Missing or invalid API credentials will prevent successful requests. Ensure proper API keys are configured.
  • API Limits or Permissions: The user associated with the API key must have permission to create items in the specified collection. Lack of permissions will result in authorization errors.

Links and References

Discussion