Directus (DrWade) icon

Directus (DrWade)

Consume Directus API

Overview

The Directus (DrWade) - Revisions: List operation allows you to retrieve a list of revision records from a Directus instance. This is useful for tracking changes, auditing, or reviewing the history of modifications made to items in your Directus collections. Common scenarios include:

  • Auditing who changed what and when in your data.
  • Building custom dashboards or reports on content changes.
  • Exporting revision logs for compliance or backup purposes.

Example use cases:

  • Fetch all revisions for review after a major update.
  • Retrieve only the latest 10 revisions for a quick audit.
  • Export revision data as CSV for external analysis.

Properties

Name Type Meaning
Return All boolean If enabled, returns all available revision records. If disabled, limits the number of results based on the "Limit" property.
Limit number The maximum number of revision records to return. Only used if "Return All" is set to false. Accepts values between 1 and 100.
Split Into Items boolean If enabled, outputs each revision as a separate item in the n8n workflow. If disabled, returns all revisions in a single item.
JSON/RAW Parameters boolean If enabled, allows you to specify query parameters as raw JSON instead of using the UI fields.
Query Parameters json Custom query parameters as a flat JSON object. Only shown if "JSON/RAW Parameters" is enabled.
Additional Fields collection Extra options to refine the query, such as aggregation, export format, filtering, sorting, grouping, and more. See below for details.

Additional Fields (within "Additional Fields" collection):

  • Aggregate: Apply aggregation functions (e.g., count, sum, avg) to revision data.
  • Binary Property for Export Data: Name of the binary property to store exported file data.
  • Deep (JSON): Set nested query parameters for related datasets.
  • Export: Choose to export the API response as a file (CSV, JSON, XML).
  • Fields: Specify which fields to return in the response.
  • File Name for Export Data: File name (without extension) for exported data.
  • Filter (JSON): Filter revisions by specific conditions.
  • Group By: Group results by specified fields.
  • Meta: Specify metadata to include in the response.
  • Offset: Number of items to skip (for pagination).
  • Search: Search string to filter revisions.
  • Sort: Sort order for returned revisions.

Output

  • json:
    • If "Split Into Items" is enabled, each output item contains a single revision record as a JSON object.
    • If disabled, all revision records are included in an array within a single output item.
  • binary (optional):
    • If "Export" is used, the node outputs a binary file (CSV, JSON, or XML) containing the revision data. The binary property name and file name can be customized.

Example output (single item, not split):

{
  "json": [
    {
      "id": 123,
      "activity": "...",
      "collection": "...",
      // ...other revision fields
    },
    {
      "id": 124,
      "activity": "...",
      "collection": "...",
      // ...other revision fields
    }
  ]
}

Example output (split into items):

{
  "json": {
    "id": 123,
    "activity": "...",
    "collection": "...",
    // ...other revision fields
  }
}

If exporting:

  • The output will include a binary property with the exported file attached.

Dependencies

  • Directus API: Requires access to a running Directus instance.
  • API Credentials: You must configure the "directusApi" credentials in n8n with appropriate permissions to read revisions.

Troubleshooting

Common issues:

  • Authentication errors: Ensure your API credentials are correct and have permission to access revisions.
  • Invalid JSON in parameters: When using "JSON/RAW Parameters" or filters, ensure your JSON syntax is valid.
  • Empty results: Check your filters, search, or limit settings; there may be no matching revisions.
  • Export errors: If export fails, verify that the export format is supported and that the binary property name does not conflict with other properties.

Error messages:

  • "error": "Unexpected token ...": Indicates invalid JSON input in one of the parameters.
  • "error": "Request failed with status code 403": Insufficient permissions; check your Directus user role.
  • "error": "Network Error": n8n cannot reach the Directus server; check network connectivity and API URL.

Links and References


Discussion