Directus (flagbit) icon

Directus (flagbit)

Consume Directus API

Field → Create

AI-generated

Overview

This node creates a new field in a specified collection within a Directus database. It is useful for dynamically adding fields to collections during automation workflows, such as adding custom attributes to content types or user data. For example, you can create a new 'firstName' field of type 'string' in the 'articles' collection.

Use Case Examples

  1. Create a 'firstName' string field in the 'articles' collection to store author names.
  2. Add a 'publishedDate' field of type 'dateTime' to a blog posts collection to track publication dates.

Properties

Name Meaning
Name The name of the field to be created in the collection.
Collection Name The target collection in which the new field will be created.
Type The data type of the field, which determines how values are cast and stored in the Directus database.
JSON/RAW Parameters Whether the body parameters should be set via the UI or as raw JSON/RAW.
Body Parameters The body parameters for the field creation request, provided as JSON or RAW format.

Output

JSON

  • field - The name of the created field.
  • collection - The collection where the field was created.
  • type - The data type of the created field.
  • bodyParameters - Additional parameters sent in the request body for field creation.

Dependencies

  • Directus API with appropriate authentication credentials

Troubleshooting

  • Ensure the collection name exists and is spelled correctly to avoid errors.
  • Verify that the field name is unique within the collection to prevent conflicts.
  • Check that the data type selected is supported by Directus and matches the intended use.
  • If using JSON/RAW parameters, ensure the JSON syntax is valid to avoid parsing errors.

Discussion