Unable to retrieve Cart Details using Storefront API

API URL : https://.myshopify.com/admin/api/unstable/graphql.json

graphql Query::

{
cart(id: “gid://shopify/Cart/<cart_id>”) {
id
createdAt
updatedAt
}
}

API Response:

{
“errors”: [
{
“message”: “Field ‘cart’ doesn’t exist on type ‘QueryRoot’”,
“locations”: [
{
“line”: 3,
“column”: 3
}
],
“path”: [
“query”,
“cart”
],
“extensions”: {
“code”: “undefinedField”,
“typeName”: “QueryRoot”,
“fieldName”: “cart”
}
}
]
}

Can someone please help me out with the above issue?

Same Error i get, but not get any solution still,
have you got any solutions? if YES then pls provide me to.

Thanks.

I think that you’re using the wrong API schema. Cart queries are only available in the Storefront API, and in your example you’re asking Admin API for the Cart.

Try removing /admin from your URL request like this

https://

Also check the headers you're sending. The correct name for your request's header should be X-Shopify-Storefront-Access-Token, and of course you should use the Storefront Access Token for those requests as well.