I am trying to make a graphql request to shopify's admin api. I am using the official shopify-api-node library.
My query is as follows
const response = await shopify.graphql({
`order(id:"gid://shopify/Order/3138432598213") {
currentCartDiscountAmountSet {
shopMoney {
amount
currencyCode
}
}
}`
});
And the response is
From my understanding, this should return an object with a data field and an extensions field (I'm interested in query cost).
The response I get is simply contains order.
Is this because I'm querying storefront API? I'm confused because I want to query admin api. According to shopify docs, order under storefront API does not have the field currentCartDiscountAmountSet, whereas order under admin API does have this field. I am getting the correct order with the field currentCartDiscountAmountSet, and so I presume that I'm querying admin api. But then again, I'm not getting data and extensions?
My questions are:
When using shopify-api-node, how to I specify if I want to query admin or storefront API?
Why am I not getting data and extensions in my response? Is it actually because I'm querying storefront api? If so, then why am I successfully able to get currentCartDiscountAmountSet?