Shopify API - Searches for customers that match a supplied query using Postman

Shopify API 2024 – Searches for customers that match a supplied query using Postman

While taking care of customers, the owner always needs customer data that matches a supplied query like country, city, order count, etc. This data will help every shop owner know where the customers are, what the customers want, and the customersโ€™ shopping habits. This data will give store owners better strategies to attract customers. Because of the reasons above, Beehexa will show you how to search for customers that match a supplied query.ย 

Now, letโ€™s explore this subject a little deeper.ย 

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

Step 1: 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, remember the Admin API access token and the API key to send a GET request in the Postman.ย 

    Shopify Connector and Profile arrow Salesforce
    Shopify Salesforce Integration
    Shopify Connector and Profile arrow Hubspot
    Shopify Hubspot Integration
    Shopify Connector and Profile arrow Zoho
    Shopify Zoho Integration

    Step 2: Searches for customers that match a supplied query using Postman

    In Shopify API, you can query multiple customersโ€™ information in one call. The API will return all customers that match many supplied queries.ย 

    The list below is supported queries:

    accepts_marketing, activation_date, address1, address2, city, company, country, customer_date, customer_first_name, customer_id, customer_last_name, customer_tag, email, email_marketing_state, first_name, first_order_date, id, last_abandoned_order_date, last_name, multipass_identifier, orders_count, order_date, phone, province, shop_id, state, tag, total_spent, updated_at, verified_email, product_subscriber_status. All other queries returns all customers.

    Now, we are ready to search for customers that match a supplied query using Postman.ย 

      ย 

        • Log in to your Postman and create a new workspace

        • Then, 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.

        In this example, Beehexa will search for customers with an address in Viet Nam and the name “Hoai”.

        You can copy this example. Remember to change [resource] to [customers/search.json?query=Hoai+country:vietnam]:

        https://ed86d512a2c95387ffa25f67074a222b:[email protected]/admin/api/2021-10/customers/search.json?query=Hoai+country:vietnam

        searches for customers that match a supplied query using postman

        The maximum number of results to show โ‰ค 250, default 50

        Then clicks on send

        Response: The API will return the data like this.ย 

        {
            "customers": [
                {
                    "id": 5484387270719,
                    "email": "[email protected]",
                    "accepts_marketing": false,
                    "created_at": "2021-11-08T18:13:34+09:00",
                    "updated_at": "2022-03-18T18:28:36+09:00",
                    "first_name": "Hoai",
                    "last_name": "Lam",
                    "orders_count": 5,
                    "state": "enabled",
                    "total_spent": "200315.20",
                    "last_order_id": 4341526331455,
                    "note": null,
                    "verified_email": false,
                    "multipass_identifier": null,
                    "tax_exempt": false,
                    "phone": null,
                    "tags": "",
                    "last_order_name": "#1247",
                    "currency": "AUD",
                    "addresses": [
                        {
                            "id": 6705218158655,
                            "customer_id": 5484387270719,
                            "first_name": "Hoai",
                            "last_name": "Lam",
                            "company": "Beehexa",
                            "address1": "20 Le Loi",
                            "address2": "",
                            "city": "Hue",
                            "province": null,
                            "country": "Vietnam",
                            "zip": "52000",
                            "phone": "0373289426",
                            "name": "Hoai Lam",
                            "province_code": null,
                            "country_code": "VN",
                            "country_name": "Vietnam",
                            "default": false
                        },
                        {
                            "id": 6833735827519,
                            "customer_id": 5484387270719,
                            "first_name": "Yushin",
                            "last_name": "Lam",
                            "company": "Beehexa",
                            "address1": "1925 Washington Street",
                            "address2": "",
                            "city": "Hollywood",
                            "province": "Florida",
                            "country": "United States",
                            "zip": "33020",
                            "phone": "(361) 386-5113",
                            "name": "Yushin Lam",
                            "province_code": "FL",
                            "country_code": "US",
                            "country_name": "United States",
                            "default": false
                        },
                        {
                            "id": 6925741523007,
                            "customer_id": 5484387270719,
                            "first_name": "Hoai",
                            "last_name": "Lam",
                            "company": "ABC",
                            "address1": "2089 Hidden Pond Road",
                            "address2": "",
                            "city": "Vanleer",
                            "province": "Tennessee",
                            "country": "United States",
                            "zip": "37181",
                            "phone": "6157634093",
                            "name": "Hoai Lam",
                            "province_code": "TN",
                            "country_code": "US",
                            "country_name": "United States",
                            "default": false
                        },
                        {
                            "id": 6925959004223,
                            "customer_id": 5484387270719,
                            "first_name": "Hoai",
                            "last_name": "Lam",
                            "company": "ABC",
                            "address1": "2089 Hidden Pond Road",
                            "address2": "",
                            "city": "Vanleer",
                            "province": "Tennessee",
                            "country": "United States",
                            "zip": "37181",
                            "phone": "(615) 763-4093",
                            "name": "Hoai Lam",
                            "province_code": "TN",
                            "country_code": "US",
                            "country_name": "United States",
                            "default": false
                        },
                        {
                            "id": 6947645325375,
                            "customer_id": 5484387270719,
                            "first_name": "Yushin",
                            "last_name": "Lam",
                            "company": "Beehexa",
                            "address1": "1921 Washington Street",
                            "address2": "",
                            "city": "Corpus Christi",
                            "province": "Texas",
                            "country": "United States",
                            "zip": "78476",
                            "phone": "13613865113",
                            "name": "Yushin Lam",
                            "province_code": "TX",
                            "country_code": "US",
                            "country_name": "United States",
                            "default": false
                        },
                        {
                            "id": 6955568398399,
                            "customer_id": 5484387270719,
                            "first_name": "Yushin",
                            "last_name": "Lam",
                            "company": "Beehexa",
                            "address1": "1921 Washington Street",
                            "address2": "",
                            "city": "Corpus Christi",
                            "province": "Texas",
                            "country": "United States",
                            "zip": "78476",
                            "phone": "1 (361) 386-5113",
                            "name": "Yushin Lam",
                            "province_code": "TX",
                            "country_code": "US",
                            "country_name": "United States",
                            "default": true
                        }
                    ],
                    "accepts_marketing_updated_at": "2021-11-08T18:13:35+09:00",
                    "marketing_opt_in_level": null,
                    "tax_exemptions": [],
                    "sms_marketing_consent": null,
                    "admin_graphql_api_id": "gid://shopify/Customer/5484387270719",
                    "default_address": {
                        "id": 6955568398399,
                        "customer_id": 5484387270719,
                        "first_name": "Yushin",
                        "last_name": "Lam",
                        "company": "Beehexa",
                        "address1": "1921 Washington Street",
                        "address2": "",
                        "city": "Corpus Christi",
                        "province": "Texas",
                        "country": "United States",
                        "zip": "78476",
                        "phone": "1 (361) 386-5113",
                        "name": "Yushin Lam",
                        "province_code": "TX",
                        "country_code": "US",
                        "country_name": "United States",
                        "default": true
                    }
                }
            ]
        }

        searches for customers using postman

        The above are all steps to search for customers that match a supplied query using Postman with Shopify API. Please comment below or refer to our Shopify API documentation if you have any questions.

        These steps will be shown visually in the video below.

        https://youtu.be/4dFrodk6HlU
        Shopify API – Searches for customers that match a supplied query using Postman.

        Hopefully, you can do it!