How to get just the file URL from the API

Viewed 1968

When I specify fields in my API request for most things I get the single value. However when I want just the URL of a file, I get everything, or more than I want. If I specify file.data.url in my filter I get this:

enter image description here

2 Answers

It is a known issue of the Directus. Currently, fields in the param are working with the column of the database table. The value of data variable is not the part of directus_files table.

Currently, you need to use the data object with all the values.

Add fields as paramater to request ?fields=file.data.full_url

I would recommend full_url rather than url as url is relative.

Related