Shopify API: How to count all orders using Postman

Shopify API: How to count all orders using Postman

Are you the owner, and Do you want to count all orders of your stores? This article is for you. Beehexa will show you how to count all open orders, closed orders, or orders with any status. It will help you know the orders quantity with each status. Detect data discrepancies if any. 

Now, let’s dive into the article to know how to count all orders in Shopify API using Postman. 

If this is the first time you make a call in the Postman, you must generate API credentials from the Shopify admin

Generate API Credentials From Shopify Admin

Follow the process in How to build a custom app for Shopify in 2022? to know how to access Shopify API. 

  • After creating an app, you need to assign “Orders” scopes to the admin API scopes. 
  • Remember the Admin API access token and the API key to count all orders in the Postman. 

Now, we will take the first call: Count all open orders

Count All Open Orders

  • Log in to your Postman and create a new workspace
  • Create a new GET with this URL:
https://{API_key}:{admin_API_access_token}@{shop}.myshopify.com/admin/api/{api-version}/{resource}
Code language: JavaScript (javascript)
  1. {API_key} – The API key that you generated.
  2. {admin_API_access_token} – The admin API access token that you generated.
  3. {shop} – The name of your development store.
  4. {api-version} – The supported API version that you want to use.
  5. {resource} – A resource endpoint from the REST Admin API.

Or you can copy this example, remember change {resource} to {orders/count.json?status=open}:

https://ed86d512a2c95387ffa25f67074a222b:[email protected]/admin/api/2021-10/orders/count.json?status=open
Code language: JavaScript (javascript)

Note: String = open, you can use either word to call the command. It will return the same result as the number of open orders.

  • Paste the URL above.
get all open orders

Then click on send

Response: The API will return all open orders count. 

{ "count": 225 }
Code language: JSON / JSON with Comments (json)
the open orders count

Count All Closed Orders

In the second call, you just change the status of orders you want to get. In this case, we will change the status from open to closed. You can read Shopify API – How To Close An Order Using Postman blog to understand what are closed orders?.

  • Log in to your Postman and create a new workspace
  • Create a new GET with this URL:
https://{API_key}:{admin_API_access_token}@{shop}.myshopify.com/admin/api/{api-version}/{resource}
Code language: JavaScript (javascript)
  1. {API_key} – The API key that you generated.
  2. {admin_API_access_token} – The admin API access token that you generated.
  3. {shop} – The name of your development store.
  4. {api-version} – The supported API version that you want to use.
  5. {resource} – A resource endpoint from the REST Admin API.

Or you can copy this example, remember change {resource} to {orders/count.json?status=closed}:

https://ed86d512a2c95387ffa25f67074a222b:[email protected]/admin/api/2021-10/orders/count.json?status=closed
Code language: JavaScript (javascript)
  • Paste the URL above.
count all closed orders

Then click on send

Response: The API will return all closed orders count. 

{ "count": 36 }
Code language: JSON / JSON with Comments (json)
the closed orders count

Count All Orders

With the final call, you just change the status of orders you want to get. In this case, we will change the status from closed to any.

This call will return all orders with any status including open, closed, canceled. 

  • Log in to your Postman and create a new workspace
  • Create a new GET with this URL:
https://{API_key}:{admin_API_access_token}@{shop}.myshopify.com/admin/api/{api-version}/{resource}
Code language: JavaScript (javascript)
  1. {API_key} – The API key that you generated.
  2. {admin_API_access_token} – The admin API access token that you generated.
  3. {shop} – The name of your development store.
  4. {api-version} – The supported API version that you want to use.
  5. {resource} – A resource endpoint from the REST Admin API.

Or you can copy this example, remember change {resource} to {orders/count.json?status=any}:

https://ed86d512a2c95387ffa25f67074a222b:shpat_91e9827e3eec22b367[email protected]/admin/api/2021-10/orders/count.json?status=any
Code language: JavaScript (javascript)
  • Paste the URL above.
count all orders

Then click on send
Response: The API will return all orders count.

{ "count": 262 }
Code language: JSON / JSON with Comments (json)
all orders count

The above are all steps to count all orders using Postman with Shopify API. If you have any questions, please leave a comment below or refer to our Shopify api documentation.

If you still do not understand the tutorial’s content, you can watch the video below for a more overview.

Shopify API – How to count all orders using Postman

Hopefully, you can do it!

Shopify API: How to count all orders using Postman

Shopify API: How to count all orders using Postman

Join The Ride

Subscribe to our fortnightly newsletter with stories from our latest adventures and the best travel tips

Table of Contents