Shopify-API-Node: storefront vs adminapi graphql queries

Hi,

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:"

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.

According to your answer at [here](https://community.shopify.com/c/Shopify-APIs-SDKs/GraphQL-Cost-is-not-in-the-Response/m-p/603790#M40992), this is because I'm querying storefront API. I'm confused because I want to query admin api. According to your 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:

1. When using shopify-api-node, how to I specify if I want to query admin or storefront API?

2. 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?

Hey @asoola ,

For your first question: the shopify-api-node library works with the Admin API only by default (/admin/api is the pathname specified in the library etc).

For your second question: you can use the shopify.callGraphqlLimits property to see the limits for a GraphQL Admin API call, e.g. with

shopify.on('callGraphqlLimits', (limits) => console.log(limits));

the value of which will be an object like:

{ restoreRate: 50, remaining: 998, current: 2, max: 1000 }