@ShopifyDevSup For GraphSQL Explorer in Shopify the above query+variable combination is working.
Ie, over here - https://admin.shopify.com/store/{{store-name}}/apps/shopify-graphiql-app.
In the network console, the request is reaching to https://shopify-graphiql-app.shopifycloud.com/admin/api/2023-04/graphql. And the update is happening correctly.
But when we use the Rest endpoint - https://{{store_name}}.myshopify.com//admin/api/2023-01/graphql.json to send the query and variables. it returns below error
{
"errors": [
{
"message": "Variable $definition of type MetafieldDefinitionUpdateInput! was provided invalid value for validations (Field is not defined on MetafieldDefinitionUpdateInput)",
"locations": [
{
"line": 2,
"column": 36
}
],
"extensions": {
"value": {
"ownerType": "PRODUCT",
"namespace": "custom",
"key": "product_store_locations",
"validations": [
{
"name": "choices",
"value": "[\"Thiruvananthapuram\"]"
}
]
},
"problems": [
{
"path": [
"validations"
],
"explanation": "Field is not defined on MetafieldDefinitionUpdateInput"
}
]
}
}
]
}
The same error when we using shopify_python_api
import shopify
session = shopify.Session(SHOP_URL, api_version, access_token)
shopify.ShopifyResource.activate_session(session)
query = """
mutation UpdateMetafieldDefinition($definition: MetafieldDefinitionUpdateInput!) {
metafieldDefinitionUpdate(definition: $definition) {
updatedDefinition {
id
name
validations {
name
type
value
}
}
userErrors {
field
message
}
}
}
"""
variables = {
"definition": {
"ownerType": "PRODUCT",
"namespace": "custom",
"key": "product_store_locations",
"validations": [
{
"name": "choices",
"value": "[\"Thiruvananthapuram\"]"
}
]
}
}
print(shopify.GraphQL().execute(query=query, variables=variables))