Directus icon

Directus

Consume Directus API

Overview

This node integrates with the Directus API, a headless CMS and data platform. Specifically, for the Activity resource with the Get operation, it retrieves a single activity record by its ID from the Directus system.

Typical use cases include:

  • Fetching detailed information about a specific user or system activity logged in Directus.
  • Retrieving audit trail entries or comments related to content changes.
  • Integrating activity logs into workflows for monitoring or reporting purposes.

For example, you might use this node to get the details of an activity entry with ID 123 to display who made a change and when, or to trigger further automation based on that activity.

Properties

Name Meaning
ID The unique numeric identifier (index) of the activity record to retrieve.
Additional Fields Optional collection of extra parameters:
- Fields Specify which fields of the activity object should be returned.
- Meta Specify what metadata should be included in the response.

Output

The output is a JSON object representing the requested activity record. It contains all the standard fields of an activity entry as returned by the Directus API, potentially filtered by the specified fields and including any requested metadata.

Example output structure (simplified):

{
  "id": 1,
  "action": "create",
  "collection": "articles",
  "item": 42,
  "user": 5,
  "comment": "Created new article",
  "timestamp": "2023-01-01T12:00:00Z",
  "meta": {
    // optional metadata fields if requested
  }
}

No binary data is output for this operation.

Dependencies

  • Requires connection to a Directus instance via its REST API.
  • Needs an API key credential or equivalent authentication token configured in n8n to authorize requests.
  • Uses internal helper functions to make HTTP requests to the Directus API endpoints.

Troubleshooting

  • Invalid ID or Not Found: If the provided ID does not exist, the node will throw an error indicating the resource was not found. Verify the ID is correct.
  • Authentication Errors: Ensure the API credentials are valid and have permission to access the Activity resource.
  • Network Issues: Connectivity problems to the Directus server will cause request failures.
  • Malformed Additional Fields: Incorrect JSON or unsupported field names in the "Additional Fields" may cause errors or unexpected results.
  • To handle errors gracefully, enable the "Continue On Fail" option in the node settings.

Links and References

Discussion