Shopify API: How to count all orders using Postman

Shopify API 2024: How to count all orders using Postman

Are you the owner, and Do you want to count all orders from your stores? This article is for you. Beehexa will show you how to count all orders using Postman with any status. It will help you know the order 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 of How to build a custom app for Shopify in 2022? to know how to access Shopify API.ย 

    ย 

      • After creating an app, you must 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}

        ย 

          1. {API_key} โ€“ The API key that you generated.

          1. {admin_API_access_token} โ€“ The admin API access token that you generated.

          1. {shop} โ€“ The name of your development store.

          1. {api-version} โ€“ The supported API version that you want to use.

          1. {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

        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
          }

          the open orders count

          Shopify Connector and Profile arrow Magento
          Shopify Magento Integration
          Shopify Connector and Profile arrow Salesforce
          Shopify Salesforce Integration
          Shopify Connector and Profile arrow Pipedrive
          Shopify Pipedrive Integration
          Shopify Connector and Profile arrow Clover POS
          Shopify Clover-pos Integration

          Count All Closed Orders

          In the second call, you change the status of the 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 closed orders are?.

            ย 

              • 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}

              ย 

                1. {API_key} โ€“ The API key that you generated.

                1. {admin_API_access_token} โ€“ The admin API access token that you generated.

                1. {shop} โ€“ The name of your development store.

                1. {api-version} โ€“ The supported API version that you want to use.

                1. {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

                ย 

                  • Paste the URL above.

                count all closed orders

                Then click on send

                Response: The API will return all closed orders count.ย 

                {
                    "count": 36
                }

                the closed orders count

                Count All Orders Using Postman

                With the final call, you change the status of the 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, or 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}

                    ย 

                      1. {API_key} โ€“ The API key that you generated.

                      1. {admin_API_access_token} โ€“ The admin API access token that you generated.

                      1. {shop} โ€“ The name of your development store.

                      1. {api-version} โ€“ The supported API version that you want to use.

                      1. {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:[email protected]/admin/api/2021-10/orders/count.json?status=any

                      ย 

                        • Paste the URL above.

                      count all orders

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

                      {
                          "count": 262
                      }

                      all orders count

                      The above are all steps to count all orders using Postman with Shopify API. If you have any questions, please comment below or refer to our blog: What is an API?. Besides, you can see more Shopify API documentation in the developer docs.

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

                      https://youtu.be/1VZWiLUAYq4
                      Shopify API – How to count all orders using Postman

                      Hopefully, you can do it!