Directus (flagbit) icon

Directus (flagbit)

Consume Directus API

Asset → Get

AI-generated

Overview

This node operation retrieves an asset by its ID from a Directus system. It supports fetching the asset's metadata and optionally includes the corresponding file data. Users can specify query parameters either as key-value pairs or as raw JSON, and can customize the thumbnail output with options such as format, size, quality, and image transformations. This operation is useful for scenarios where you need to access specific asset details or download the asset file, for example, to display images or documents in an application or to process media files further.

Use Case Examples

  1. Retrieve an image asset by its ID and include the binary file data for display in a web app.
  2. Fetch asset metadata with custom thumbnail dimensions and format for generating previews.
  3. Get asset details using raw JSON query parameters for advanced filtering or API integration.

Properties

Name Meaning
JSON/RAW Parameters Whether the query parameters should be set via UI key-value pairs or as raw JSON input.
Query Parameters Query parameters as a JSON object to filter or modify the asset retrieval request, used when JSON/RAW Parameters is true.
ID The unique identifier of the asset to retrieve.
Include File Data Whether to include the binary file data of the asset along with its metadata.
Binary Property The name of the binary property that will contain the file data if included.
Additional Fields Additional optional parameters to customize the asset retrieval, such as thumbnail fit, format, dimensions, quality, and image transformations.

Output

JSON

  • id - The unique identifier of the retrieved asset.
  • title - The title or name of the asset.
  • type - The type of the asset (e.g., image, document).
  • url - The URL to access the asset file.
  • metadata - Metadata associated with the asset, such as dimensions, size, and format.
  • fileData - The binary file data of the asset if included.

Dependencies

  • Directus API endpoint and authentication credentials

Troubleshooting

  • Ensure the asset ID provided is correct and exists in the Directus system to avoid 'not found' errors.
  • If including file data, verify that the binary property name matches the expected property in the workflow to prevent missing file data.
  • When using JSON/RAW parameters, ensure the JSON syntax is valid to avoid parsing errors.

Links

Discussion