Directus icon

Directus

Consume Directus API

Overview

The node integrates with the Directus API to perform various operations on different resources. Specifically, for the Activity resource with the List operation, it fetches a list of activity records from the Directus backend.

This operation is useful when you want to retrieve audit logs, user activities, or system events tracked by Directus. For example, you might use this node to:

  • Monitor recent changes or comments in your Directus project.
  • Generate reports based on user activities.
  • Aggregate activity data for analytics.

The node supports flexible querying, filtering, sorting, and exporting of the activity data, making it suitable for dashboards, automated monitoring workflows, or data synchronization tasks.

Properties

Name Meaning
Return All Boolean flag to return all results or limit the number of returned items.
Limit Number specifying the maximum number of activity objects to return (1-100). Only used if "Return All" is false.
Split Into Items Boolean indicating whether to output each element of an array as its own item (true) or as a single array (false).
JSON/RAW Parameters Boolean to choose between setting query parameters via UI fields or providing raw JSON input.
Query Parameters JSON object representing query parameters for filtering, sorting, pagination, etc., when "JSON/RAW Parameters" is true.
Additional Fields Collection of optional additional query parameters including:
- Aggregate functions (count, sum, avg, min, max, distinct variants) applied on specified fields.
- Binary property name for export data.
- Deep (nested relational dataset parameters).
- Export format (json, csv, xml).
- Fields to return.
- File name for export.
- Filter conditions.
- Group By field(s).
- Metadata to include.
- Offset for pagination.
- Search query.
- Sort order.

Output

  • The output json field contains the fetched activity data from Directus.
  • If "Split Into Items" is enabled and the response is an array, each activity record is output as a separate item.
  • If an export format is selected (json, csv, xml), the node also outputs binary data containing the exported file under the specified binary property name (default "data").
  • The binary data includes the file content with appropriate MIME type and filename extensions matching the export format.
  • In case of errors and if "Continue On Fail" is enabled, the output will contain error messages in the json field.

Dependencies

  • Requires a valid connection to a Directus instance via an API key credential configured in n8n.
  • The node uses Directus REST API endpoints corresponding to the Activity resource.
  • No other external dependencies are required.
  • Proper permissions on the Directus API are necessary to read activity data.

Troubleshooting

  • Common Issues:

    • Invalid or missing API credentials will cause authentication failures.
    • Incorrect query parameters or malformed JSON input can lead to request errors.
    • Requesting too many items without pagination may result in timeouts or large payloads.
    • Exporting data requires sufficient memory; very large exports might fail.
  • Error Messages:

    • Authentication errors: Check API key validity and permissions.
    • JSON parse errors: Ensure JSON inputs are correctly formatted.
    • Rate limiting or server errors: Retry after some time or check Directus server health.
    • Field or parameter not found: Verify that requested fields or aggregation functions exist in the Directus schema.
  • To resolve issues:

    • Enable "Continue On Fail" to handle errors gracefully in workflows.
    • Validate JSON inputs using external tools before pasting.
    • Use limits and pagination to reduce load.
    • Confirm API endpoint availability and user permissions.

Links and References

Discussion