Directus (flagbit) icon

Directus (flagbit)

Consume Directus API

Collection → Create

AI-generated

Overview

This node creates a new collection in the Directus system. It is useful for automating the setup of new data collections with specific configurations, such as defining fields, display templates, and other collection properties. For example, it can be used to programmatically create a collection for articles with custom fields and settings.

Use Case Examples

  1. Creating a new collection named 'articles' with specific fields and display settings.
  2. Automating the creation of collections with predefined archive and unarchive values.

Properties

Name Meaning
Collection Unique name of the collection to be created, required for identification.
JSON/RAW Parameters Determines whether the body parameters are set via UI key-value pairs or as raw JSON input.
Body Parameters Body parameters as JSON or RAW input, used when JSON/RAW Parameters is true.
Additional Fields Optional additional settings for the collection such as archive field, display template, fields array, icon, note, singleton status, sort field, translation, and visibility settings.

Output

JSON

  • id - Unique identifier of the created collection.
  • collection - Name of the created collection.
  • fields - Array of fields created within the collection, if any.
  • note - Note or description of the collection.
  • icon - Icon assigned to the collection.
  • singleton - Boolean indicating if the collection is a singleton.
  • hidden - Boolean indicating if the collection is hidden in the admin app.

Dependencies

  • Directus API with appropriate authentication credentials

Troubleshooting

  • Ensure the collection name is unique and valid to avoid conflicts.
  • If using JSON/RAW parameters, validate the JSON format to prevent parsing errors.
  • Check API authentication credentials if the node fails to connect or create the collection.
  • Verify that required fields are provided, especially the collection name.

Links

Discussion