Directus icon

Directus

Consume Directus API

Overview

This node integrates with the Directus API to manage webhooks, specifically supporting an operation to update multiple webhooks at once. The "Update Multiple" operation allows users to modify several webhook entries in a single request by specifying their primary keys and the data fields to update.

Common scenarios for this node include:

  • Bulk updating webhook configurations after changes in your system.
  • Modifying multiple webhook URLs or actions simultaneously.
  • Automating maintenance tasks on webhook settings without manual intervention.

For example, if you have multiple webhooks that need their names or target URLs updated due to a service migration, this node can efficiently apply those changes in one API call.

Properties

Name Meaning
Data (JSON) A JSON object containing two required properties:
- keys: An array of primary keys identifying the webhooks to update.
- data: An object with any properties from the webhook object to be updated (e.g., name, url, actions).

Example of the expected JSON input for the "Data (JSON)" property:

{
  "keys": [15, 41],
  "data": {
    "name": "Build Website"
  }
}

Output

The node outputs the response from the Directus API after attempting to update the specified webhooks. The output is structured as JSON objects representing the updated webhook records or the API's confirmation response.

If the API returns multiple updated webhook objects, each will be output as a separate item. If the response is a simple confirmation or status message, it will be output as a single JSON object.

No binary data output is associated with this operation.

Dependencies

  • Requires a valid connection to a Directus instance via an API key credential configured in n8n.
  • The node uses the Directus REST API endpoints for webhooks.
  • Proper permissions are needed on the Directus side to perform bulk updates on webhooks.

Troubleshooting

  • Invalid JSON Input: If the "Data (JSON)" property contains malformed JSON, the node will throw a parsing error. Ensure the JSON is correctly formatted.
  • Missing Keys or Data: The keys array and data object are mandatory. Omitting either will cause the API request to fail.
  • Permission Denied: If the API credentials lack permission to update webhooks, the node will return an authorization error.
  • Non-existent Webhook Keys: Specifying keys that do not correspond to existing webhooks may result in partial updates or errors.
  • API Errors: Network issues or Directus server errors will propagate as node errors. Check connectivity and Directus server health.

To resolve errors:

  • Validate JSON syntax before running the node.
  • Confirm API credentials have sufficient rights.
  • Verify the webhook keys exist in the Directus instance.
  • Use the node's "Continue On Fail" option to handle errors gracefully in workflows.

Links and References

Discussion