Directus icon

Directus

Consume Directus API

Overview

The Activity → Delete operation in this n8n node is designed to delete a specific comment from the Directus Activity resource. This is achieved by providing the unique identifier (ID) of the comment you wish to remove. The node interacts with the Directus API to perform this deletion.

Common scenarios where this node is beneficial:

  • Automating moderation workflows by removing inappropriate or outdated comments.
  • Cleaning up activity logs as part of data management routines.
  • Integrating with other systems to synchronize deletions based on external triggers.

Practical example:
Suppose you have an automated workflow that flags and removes spam comments from your Directus-powered application. You can use this node to delete flagged comments by passing their IDs.


Properties

Name Type Meaning
ID Number Unique identifier for the comment to delete.

Output

  • The output will be a JSON object containing the response from the Directus API after attempting to delete the specified comment.
  • The structure typically includes confirmation of deletion or details about the deleted comment, depending on the API's response.
  • If an error occurs and "Continue On Fail" is enabled, the output will include an error field with the error message.

Example output:

{
  "id": 123,
  "comment": "This comment has been deleted.",
  // ...other fields as returned by Directus
}

or, in case of error:

{
  "error": "Comment not found"
}

Dependencies

  • Directus API: Requires 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 correspond to an existing comment, the API may return an error such as "Comment not found".
  • Insufficient Permissions: The API credentials used must have permission to delete activity comments; otherwise, a permissions error will occur.
  • Network/API Errors: Connectivity issues or incorrect API endpoint configuration can result in failed requests.

Error messages and resolutions:

  • "Comment not found": Ensure the ID is correct and the comment exists.
  • "Unauthorized" or "Forbidden": Check that the API credentials have the necessary permissions.
  • "Network Error": Verify network connectivity and Directus API URL settings.

Links and References

Discussion