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

Lull
Excursionist
34 1 6

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.

Lull_0-1629721474744.png

Thanks,

-Louise

Replies 4 (4)
Amrish_Patel
Shopify Expert
3 0 0

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

Louise_Elmose_H
Shopify Partner
78 2 18

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. 

tewe
Shopify Partner
234 44 100

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

• Was my reply helpful? Click Like to let me know!
• Was your question answered? Mark it as an Accepted Solution
• Check out our Price Updater App
Trudy
Shopify Partner
4 0 1

@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 🙂

Looking to customize your theme? Don't hire a developer - instead check out Design Packs! https://apps.shopify.com/design-packs