Actions100
- Activity Actions
- Asset Actions
- Authentication Actions
- Collection Actions
- Extension Actions
- Field Actions
- File Actions
- Folder Actions
- Item Actions
- Permission Actions
- Preset Actions
- Relation Actions
- Revisions Actions
- Roles Actions
- Settings Actions
- Users Actions
- Utilities Actions
Overview
The Directus node for n8n allows you to interact with the Directus API. Specifically, the Folder → Delete Multiple operation enables you to delete multiple folders in your Directus instance at once by providing an array of folder primary keys (IDs). This is useful for bulk management tasks, such as cleaning up unused folders or automating the removal of specific sets of folders.
Practical Example:
Suppose you have a workflow that identifies obsolete folders based on certain criteria. You can use this operation to pass their IDs and remove them all in one step, streamlining your data management process.
Properties
Name | Type | Meaning |
---|---|---|
Keys (JSON) | JSON | An array of folder primary keys (IDs) to be deleted. Example: ["id1", "id2", ...] |
Output
- The output will be a single field named
json
, containing the response from the Directus API after attempting to delete the specified folders. - The structure of the response depends on the Directus API but typically includes information about the deletion result (e.g., success status, number of items deleted, or error details if any).
Example Output:
{
"json": {
// Response from Directus API, e.g.,
"data": {
// Details about deleted folders or confirmation message
}
}
}
- If an error occurs and "Continue On Fail" is enabled, the output will contain an
error
field with the error message.
Dependencies
- Directus API: Requires access to a running Directus instance.
- API Credentials: You must configure the
directusApi
credentials in n8n to authenticate requests.
Troubleshooting
Common Issues:
- Invalid or missing folder IDs: If the provided keys do not correspond to existing folders, the API may return an error.
- Insufficient permissions: The API credentials used must have permission to delete folders; otherwise, you'll receive an authorization error.
- Malformed JSON: The "Keys (JSON)" property must be a valid JSON array of strings. Invalid JSON will cause parsing errors.
Error Messages & Resolutions:
"Unexpected token ... in JSON"
: Ensure the "Keys (JSON)" input is valid JSON (e.g.,["id1", "id2"]
)."Permission denied"
: Check that your API credentials have the necessary rights to delete folders."Folder not found"
: One or more provided IDs do not exist; verify the list of IDs.