How do I get the file ID needed in order to call the mutation fileUpload?

Hi,

I want to use the fileUpload mutation which requires an ID as input parameter, but I cannot find the file id in e.g. the “files” connection on the query root.

Thanks,

-Louise

Even I tried to get the ID but can not get. Did you find a solution to it?

No I suspect that either the files services are designede to work in an entirely different way - e.g. files should be staged first (currently I see this ad an option if you are not able to upload files on a server yourself) , OR that the services has some bugs as they are relatively new.

Hi @Lull ,

you get the file ID for the mutations fileUpdate and fileDelete by refering to the GenericFile. The query then looks as follows:

{
 files(first:10) {
     edges {
      node {
      ... on GenericFile {
          url
          id
          alt
      }
    }
 }
} 
}

Regards

Thomas

1 Like

@tewe

Thank you!! This was so helpful.

My mutation is returning the id, but the url is blank.

Can I use the id to query the files? if so, do you have an example (the docs are sparse and the App says I don’t have read_files/write_files permissions - also can I get these permissions on the app)

Any help is greatly appreciated :slightly_smiling_face:

You saved my day! Thanks a lot