Error trying to update filename through the GraphQL API

rick_d
Shopify Partner
1 0 0

Greetings,

 

I'm trying to update an image's filename using the GraphQL API as described in the docs but I'm getting an error stating "Field 'filename' doesn't exist on type 'File'".

Did anybody have success updating (or at least reading) this field recently? I suspect the API may have been changed without notice (big woop if so).

Here's the query I tried:

 

mutation fileUpdate($files: [FileUpdateInput!]!) {
  fileUpdate(files: $files) {
    files {
      id
      filename
    }
    userErrors {
      field
      message
    }
  }
}

And the response:

 

{
  "errors": [
    {
      "message": "Field 'filename' doesn't exist on type 'File'",
      "locations": [
        {
          "line": 5,
          "column": 7
        }
      ],
      "path": [
        "mutation fileUpdate",
        "fileUpdate",
        "files",
        "filename"
      ],
      "extensions": {
        "code": "undefinedField",
        "typeName": "File",
        "fieldName": "filename"
      }
    }
  ]
}

I also tried naming the field as "fileName" but no good.

I've tried using API versions 2023-07 (the first one to support mutating the filename property as per this blog post), 2023-10 (latest), and 2024-01 (RC).

Any help is appreciated, thank you.

Reply 1 (1)

hardik355
Shopify Partner
237 22 35

Hello @rick_d 
Hope you are doing great!

 

I think you missed a files variable. Where you can define your file name and other things.
Please check this link may help you.

If helpful then please Like and Accept Solution.
For App Development and Design changes Hire Me.
Skype: live:hardikradadiya355
Thanks