API returns null for files

Viewed 972

I'm using Directus for a headless CMS. I have been uploading a file through the Directus App but the API returns null for the file field.

How can I fix this issue?

3 Answers

(I can't comment due to reputation)

Are you ensuring this is an authenticated call, if you would like to make this a public call so anyone can access it (IE: A website frontend), then you might want to allow public READ access to directus_files.

If you are running the latest version of Directus, apparently there is a bug that completely blows up the File field. The files get uploaded but it doesn't get linked to the field.

https://github.com/directus/api/issues/1015

It should be fixed in the next build.

Use the fields parameter to get nested relational files. If the API is public and the file returns null, please verify that the public role has read access to the directus_files collection.

Related