Directus (flagbit) icon

Directus (flagbit)

Consume Directus API

Field → List

AI-generated

Overview

This node operation lists fields from a specified collection in a Directus database. It is useful for retrieving metadata about the fields within a collection, such as when dynamically generating forms or validating data structures. For example, a user can select a collection and get a list of its fields to understand the data schema or to process each field individually.

Use Case Examples

  1. Retrieve all fields from the 'articles' collection to display their names and types.
  2. List fields from a user-selected collection and split the output so each field is an individual item for further processing.

Properties

Name Meaning
Collection Name Specifies the collection from which to list fields. This is a required option and is selected from available collections via a dynamic load method.
Split Into Items Determines whether to output each element of the returned array as a separate item. If true, each field is output as its own item; if false, all fields are output as a single array.

Output

JSON

  • fields - An array of field objects retrieved from the specified collection.

Dependencies

  • Directus API access with appropriate credentials to query collections and their fields.

Troubleshooting

  • Ensure the collection name is correctly specified and exists in the Directus instance; otherwise, the node may return an error or empty result.
  • If 'Split Into Items' is enabled but the returned data is not an array, the node may fail to split items correctly.
  • Authentication issues with the Directus API can cause failures; verify API credentials and permissions.

Links

Discussion