Directus icon

Directus

Consume Directus API

Overview

This node interacts with the Directus API to list relations for a specified collection. It is useful when you want to retrieve metadata about how different collections in your Directus instance relate to each other. For example, if you have a collection of articles and another of authors, this node can list the relations that define how articles are linked to authors.

Practical scenarios include:

  • Fetching all relational fields for a given collection to understand its data model.
  • Using the relations data to dynamically build queries or UI components based on relationships.
  • Integrating with other systems by exporting relation metadata.

Properties

Name Meaning
Collection Unique name of the parent collection whose relations you want to list.
Split Into Items Boolean option to output each element of the returned array as an individual item.

Output

The node outputs JSON data representing the relations of the specified collection. The structure corresponds to the Directus API response for relations, typically an array of relation objects describing fields, related collections, and relation types.

If "Split Into Items" is enabled, each relation object is output as a separate item; otherwise, the entire array is output as a single item.

No binary data output is involved in this operation.

Dependencies

  • Requires a valid connection to a Directus instance via an API key credential.
  • The node uses the Directus REST API endpoint relations/{collection} to fetch data.
  • Proper permissions on the Directus API are necessary to read relations metadata.

Troubleshooting

  • Common issues:

    • Invalid or missing collection name will cause the API request to fail.
    • Insufficient API permissions may result in authorization errors.
    • Network connectivity problems can prevent reaching the Directus API.
  • Error messages:

    • Errors from the Directus API are propagated as error messages.
    • If the node is set to continue on failure, errors are returned as JSON with an error field.
  • Resolutions:

    • Verify the collection name exists in your Directus instance.
    • Ensure the API key has read access to the collections and relations endpoints.
    • Check network settings and API URL configuration.

Links and References

Discussion