I’m trying (and failing) to use the GraphQL API to add/update a private metafield on the Shop object using the privateMetafieldUpsert mutation.
I can get this to work fine on a Product object, but when it is given the ID of a Shop object it fails with the error “invalid id”.
For example…
Mutation:
mutation ($input: PrivateMetafieldInput!) {
privateMetafieldUpsert(input: $input) {
privateMetafield {
namespace
key
value
}
userErrors {
field
message
}
}
}
Variables: (shop ID has been changed)
{
"input": {
"owner": "gid://shopify/Shop/99999999",
"namespace": "abc",
"key": "xyz",
"valueInput": {
"value": "{}",
"valueType": "JSON_STRING"
}
}
}
Result:
{
"data": {
"privateMetafieldUpsert": null
},
"errors": [
{
"message": "invalid id",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"privateMetafieldUpsert"
]
}
],
"extensions": {
"cost": {
"requestedQueryCost": 10,
"actualQueryCost": 1,
"throttleStatus": {
"maximumAvailable": 1000,
"currentlyAvailable": 999,
"restoreRate": 50
}
}
}
}
Does anyone know why this is failing?