Directus icon

Directus

Consume Directus API

Overview

The Directus Activity: Get operation retrieves a specific activity record from a Directus instance by its unique ID. This is useful for workflows that need to fetch audit logs, user actions, or system events tracked by Directus. For example, you might use this node to:

  • Display details of a particular user action in an admin dashboard.
  • Trigger follow-up processes based on specific activities (e.g., when a record is updated).
  • Audit changes and monitor system usage.

Properties

Name Type Meaning
ID Number The unique identifier of the activity record to retrieve. Required.
Additional Fields Collection Optional parameters to refine the response. Includes:
  Fields String Specify which fields should be returned in the object.
  Meta String Specify what metadata should be included in the response.

Output

  • The output will be a single object in the json field containing the data of the requested activity record.
  • The structure of the output depends on the fields available in your Directus activity collection and any specified "Fields" or "Meta" options.
  • Example output:
    {
      "id": 1,
      "action": "update",
      "user": "john.doe",
      "timestamp": "2024-06-01T12:34:56Z",
      // ...other fields depending on your Directus setup and selected fields
    }
    

Dependencies

  • Directus API: You must have access to a running Directus instance.
  • API Credentials: The node requires valid Directus API credentials configured in n8n under the name directusApi.

Troubleshooting

  • Invalid ID: If the provided ID does not exist, the node will return an error message such as "Activity not found" or similar, depending on the Directus API response.
  • Authentication Errors: If credentials are missing or invalid, you may see errors like "401 Unauthorized" or "403 Forbidden". Ensure your API credentials are correct and have permission to read activities.
  • Malformed Additional Fields: If the "Fields" or "Meta" values are not valid JSON or do not match available fields, the API may return an error or omit those fields from the response.

Links and References

Discussion