Wix API 2024 – How to query the product categories using Postman

Table of Contents

In Wix API, you can use Postman to query the product categories. You can see an overview of the categories to make the right website organization decision. with the benefit of getting categories. Beehexa will show you how to do it in this article today. 

Let’s explore this subject a little deeper. If this is your first call in the Postman, you must generate API credentials from the Wix Developers website.

Step 1: Generate API credentials from the Wix Developers’ Website.

Follow the process in Wix API: How to get an access token and refresh the access token? To know how to access Wix API. 

  • After creating an app, remember the access and refresh tokens to send requests in the Postman. 

Step 2: Refresh the access token using Postman. 

Wix’s access token is only valid for 5 minutes, so you need to use the refresh token to request a new access token.

Flowing the steps below for refreshing the access token. 

  • Log in to your Postman and create a new workspace.
  • Create a new POST with this URL:
https://www.wix.com/oauth/access
beehexa refresh the access token 1 1

In the body section, enter the code.

Payload

{
    "grant_type": "refresh_token",
    "client_id": <APP_ID>,
    "client_secret": <APP_SECRET>,
    "refresh_token": <REFRESH_TOKEN>
}

Body Params:

NAMETYPEDESCRIPTION
grant_typestringValue must be set to “refresh_token”
client_idstringThe App ID as defined in the Wix Developers Center
client_secretstringThe Secret Key for your app as defined in your Wix Developers Center
refresh_tokenstringThe refresh token issued with the access token
beehexa refresh the access token 2
  • Then click SEND

Response:

The Postman will return the new access token and the refresh token in order to request a new access token. 

beehexa access token

Step 3: Query the product categories using Postman

Retrieves a list of up to 100 categories, given the provided paging, sorting, and filtering.

Now, we will query categories using Postman.

  • Log in to your Postman and create a new workspace.
  • Create a new POST with this URL:
https://www.wixapis.com/stores/v1/collections/query

-HEADER:  ‘Authorization: <ACCESS TOKEN>’

beehexa how to query categories using postman

In the body, enter the code.

Payload:

{
    “query”: {},
    “includeNumberOfProducts”: true,
    “includeDescription”: true
}
beehexa how to query categories using postman body

Then, Click send.

Response: 

As you can see, the Postman returned the data like this.

{
    "collections": [
        {
            "id": "00000000-000000-000000-000000000001",
            "name": "All Products",
            "media": {
                "items": []
            },
            "numberOfProducts": 13,
            "slug": "all-products",
            "visible": true
        },
        {
            "id": "789da22a-23f7-42d9-9578-93dd1e20c836",
            "name": "Shoes and T-shirt",
            "media": {
                "items": []
            },
            "numberOfProducts": 1,
            "slug": "shoes-and-t-shirt",
            "visible": true
        }
    ],
    "metadata": {
        "items": 100,
        "offset": 0
    },
    "totalResults": 2
}

beehexa how to query categories using postman result

The above steps are to query the product categories using Postman with Wix API. The next article will explore Wix rest API and multiple ways to make API calls. 

If you have any questions, let us know in the comment below or refer to our Wix API documentation.

These steps will be shown visually in the infographic below.

beehexa wix api how to query categories using postman info 01

Or you can watch this video for more overview.

Hopefully, you can do it!