page metafield update

page metafield update

gajenderdh947
Shopify Partner
13 0 1

Hi everyone,

 

I am trying to update a page metafield which is also created using api it's giving me error 

Please make me correct if i am making any mistake

 

"message": "invalid id",

 

Page Id is   89063063655 

 

fetching metafields on that page  gives me following result

 

{
    "metafields": [
        {
            "id": 25144155537511,
            "namespace": "global",
            "key": "one_page_checkout",
            "value": 1,
            "description": null,
            "owner_id": 89063063655,
            "created_at": "2024-05-21T07:37:21-04:00",
            "updated_at": "2024-05-21T07:37:21-04:00",
            "owner_resource": "page",
            "type": "number_integer",
            "admin_graphql_api_id": "gid://shopify/Metafield/25144155537511"
        },
        {
            "id": 25144179654759,
            "namespace": "custom",
            "key": "one_page_checkout",
            "value": 1,
            "description": null,
            "owner_id": 89063063655,
            "created_at": "2024-05-21T07:44:19-04:00",
            "updated_at": "2024-05-21T07:44:19-04:00",
            "owner_resource": "page",
            "type": "number_integer",
            "admin_graphql_api_id": "gid://shopify/Metafield/25144179654759"
        }
    ]
}
 
/================Request===============/
mutation MetafieldsSet($metafields: [MetafieldsSetInput!]!) {
  metafieldsSet(metafields: $metafields) {
    metafields {
      key
      namespace
      value
      createdAt
      updatedAt
    }
    userErrors {
      field
      message
      code
    }
  }
}
 
/===================variables ================/
{
  "metafields": [
    {
      "key": "one_page_checkout",
      "namespace": "custom",
      "ownerId": "gid://shopify/page/89063063655",
      "type": "number_integer",
      "value": "0"
    }
  ]
}
/=======================error logs =============/
{
    "errors": [
        {
            "message": "invalid id",
            "locations": [
                {
                    "line": 3,
                    "column": 3
                }
            ],
            "path": [
                "metafieldsSet"
            ]
        }
    ],
    "data": {
        "metafieldsSet": null
    },
    "extensions": {
        "cost": {
            "requestedQueryCost": 10,
            "actualQueryCost": 1,
            "throttleStatus": {
                "maximumAvailable": 2000.0,
                "currentlyAvailable": 1999,
                "restoreRate": 100.0
            }
        }
    }
}
Replies 0 (0)