Directus (DrWade) icon

Directus (DrWade)

Consume Directus API

Activity → Get

AI-generated

Overview

The Directus (DrWade) n8n node for the resource Activity with the operation Get retrieves a specific activity record from a Directus instance by its unique ID. This is useful for workflows where you need to fetch details about a particular activity event, such as user actions, system events, or audit logs, and use that information in subsequent automation steps.

Common scenarios:

  • Auditing user actions by fetching activity logs.
  • Triggering conditional logic based on specific activity details.
  • Integrating Directus activity data into reporting or notification workflows.

Example:
You want to retrieve the details of an activity with ID 123 and only include certain fields in the response for further processing in your workflow.


Properties

Name Type Meaning
ID Number The unique identifier of the activity to retrieve. Required.
Additional Fields Collection Optional parameters to refine the response.
└─ Fields String Comma-separated list of fields to return in the object (e.g., "id,event,action").
└─ Meta String Specifies what metadata to include in the response.

Output

  • The output will be a single item with a json property containing the activity object returned by Directus.
  • The structure of the json field depends on the fields available in the Directus activity record and any filters applied via the "Fields" or "Meta" options.
  • If the API response is not an object, the output will be { "response": <raw_response> }.

Example output:

{
  "json": {
    "id": 123,
    "action": "login",
    "user": "john.doe",
    "timestamp": "2024-06-01T12:34:56Z"
    // ...other fields depending on 'Fields' and 'Meta'
  }
}

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

Common issues:

  • Invalid ID: If the provided ID does not exist, the node may throw an error or return an empty object.
  • Insufficient Permissions: The API credentials used must have permission to read activity records; otherwise, you may receive a permissions error.
  • Malformed Additional Fields: If the "Fields" or "Meta" values are incorrectly formatted (e.g., not a valid string), the request may fail.

Error messages and resolutions:

  • "Cannot read property 'data' of undefined": Likely due to an invalid ID or insufficient permissions. Check the ID and user permissions.
  • "Request failed with status code 401/403": Authentication or authorization issue. Verify your API credentials and permissions.
  • "Unexpected token ... in JSON": Malformed input in "Fields" or "Meta". Ensure these are properly formatted strings.

Links and References

Discussion