Directus icon

Directus

Consume Directus API

Overview

The Directus - Permission: Get operation in this n8n node retrieves a specific permission rule from a Directus instance by its primary key (ID). This is useful for automation scenarios where you need to fetch and inspect the details of a particular permission, such as auditing access rules, synchronizing permissions across environments, or integrating permission data into other workflows.

Example use cases:

  • Fetching permission details to display or log them.
  • Validating that a certain permission exists before making changes.
  • Using permission data as part of an approval or review process.

Properties

Name Type Meaning
ID String Primary key of the permission rule to fetch.

Output

The output will be a single object in the json field containing the details of the requested permission rule. The structure of this object matches the Directus API's response for a permission, typically including fields such as:

{
  "id": "34",
  "role": "...",
  "collection": "...",
  "action": "...",
  "permissions": { /* ... */ },
  "fields": [ /* ... */ ],
  "validation": { /* ... */ },
  "presets": { /* ... */ },
  "limit": null,
  "status": "active",
  // ...other Directus permission properties
}

Note: The exact fields depend on your Directus setup and version.

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 correspond to any permission rule, the node may return an error or an empty result.
  • Authentication Errors: If the API credentials are missing or incorrect, you may receive authentication errors from Directus.
  • Permission Denied: The user associated with the API credentials must have sufficient rights to read permissions; otherwise, a permission error will occur.
  • Error Handling: If an error occurs and "Continue On Fail" is enabled, the output will contain an error property with the error message.

Links and References

Discussion