I use the graphql mutation fileCreate to upload files. The returned data is a list of files, and a single file has the following parameters: alt, createdAt, fileErrors, fileStatus and preview. Preview contains an “image” field, but this is null, which means there is no unique parameter I can use later on.
I need to be able to lookup the file I just uploaded at a later point to determine whether it still exists, but there is no unique identifier. I can query files on filename, but that is not unique enough, as you can e.g. upload “cat.png” several times, and then Shopify adds something to the name to make it unique. If only this new filename was returned in the fileCreate response.
As a hack I can set the file name to an id that is unique on my end, but I think there should be a less hackish solution.
Any suggestions for how I can determine whether a file I previously uploaded still exists?
@Michael_CLift I am using this query to fetch the file URL. It is giving me error ‘Access denied for mediaErrors field. Required access: read_products access scope.’ If I give read_products scope it is working correctly. But why I need to give that access to read file url? Any idea?