Actions109
- Activity Actions
- Assets Actions
- Authentication Actions
- Collections Actions
- Extensions Actions
- Fields Actions
- Files Actions
- Folders Actions
- Items Actions
- Permissions Actions
- Presets Actions
- Relations Actions
- Revisions Actions
- Roles Actions
- Settings Actions
- Users Actions
- Utilities Actions
- Webhooks Actions
Overview
This node interacts with the Directus API to retrieve asset information. Specifically, the "Assets" resource with the "Get" operation allows users to fetch details about a specific asset by its ID. It can optionally include the actual file data of the asset in the response.
Common scenarios where this node is beneficial include:
- Retrieving metadata and optionally the binary content of media files stored in Directus.
- Fetching image assets for further processing or integration into workflows.
- Accessing specific files by their unique IDs for validation, transformation, or distribution.
Practical example:
- A user wants to get an image asset from Directus by its ID and then use it in another system. They can enable the option to include the file data so that the image binary is available downstream in the workflow.
Properties
| Name | Meaning |
|---|---|
| ID | The unique identifier of the asset (file) to retrieve. This is required. |
| Include File Data | Boolean flag to specify whether the actual file data (binary content) should be included along with the asset metadata. |
| Binary Property | The name of the binary property in the node's output where the file data will be stored if included. For multipart form-data uploads, multiple mappings can be provided in the format: sendKey1:binaryProperty1,sendKey2:binaryProperty2. |
| JSON/RAW Parameters | Boolean indicating if query parameters should be provided as key-value pairs via UI or as raw JSON input. |
| Query Parameters | When JSON/RAW Parameters is enabled, this JSON object contains additional query parameters to send with the request. |
| Additional Fields | Collection of optional fields to customize the asset retrieval, including: - Fit: How the thumbnail fits within requested dimensions ( contain, cover, inside, outside).- Format: Thumbnail file format ( jpg, png, tiff, webp).- Height: Thumbnail height in pixels. - Width: Thumbnail width in pixels. - Quality: Thumbnail quality (1-100). - Key: Asset size key configured in settings. - Transforms (JSON): Array of image transformations. - Without Enlargement: Boolean to disable up-scaling of images. |
Output
The node outputs a JSON object representing the asset data retrieved from Directus. This includes metadata such as asset ID, filename, type, size, and other properties.
If "Include File Data" is enabled, the node also outputs the binary content of the file under the specified binary property name. This allows subsequent nodes in the workflow to access the actual file data for further processing or storage.
Dependencies
- Requires a valid connection to the Directus API, authenticated via an API key or token credential configured in n8n.
- The node uses internal helper functions to make HTTP requests to Directus endpoints.
- No additional external dependencies are needed beyond the Directus API access.
Troubleshooting
- Invalid ID: If the provided asset ID does not exist or is incorrect, the node will return an error indicating the asset was not found. Verify the ID is correct.
- Authentication Errors: Ensure the API credentials are valid and have permission to access the assets resource.
- Malformed JSON Parameters: When using JSON/RAW parameters, ensure the JSON syntax is correct to avoid parsing errors.
- Binary Data Missing: If "Include File Data" is enabled but no binary data appears, check that the asset actually has associated file content and that the binary property name matches the expected output.
- API Rate Limits or Network Issues: Temporary failures may occur due to network problems or API rate limits; retry or check connectivity.