beehexa integrationsidebar
beehexa beehexa logo 1

We Build HexaSync Integration Platform for Connecting ERP, POS, CRM, Accounting, and eCommerce Applications to Automate Business Processes

Wix API 2024 – How to get inventory variants using Postman

In Wix API, you can get inventory variants using Postman based on inventory item ID.

Today, Beehexa will show you how to do it in this article. 

If this is the first time you make a 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 token and the refresh token 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/accessCode language: JavaScript (javascript)
Refresh the access token using Postman with Wix API

In the body section, enter the code.

Payload:

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

Code language: JSON / JSON with Comments (json)

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
Refresh the access token using Postman with Wix API
  • Then click SEND

Response:

The Postman will return the new access token

Refresh the access token using Postman with Wix API

Step 3: Get inventory variants using Postman 

Before getting inventory variants, we will get the product’s inventory item ID because that parameter is included in the next call. To have the inventory item ID we must get the product.

  • From Wix dashboard
  • Go to “Store products”
  • Click on “Products”
  • Then click on the product that you want to get the product ID. In this case, I will choose this T-Shirt.
  • Finally, copy the product ID in the URL. 

Get product ID using Postman with Wix API

We will rely on the product ID to get the product.

Product ID: 61ea866c-1564-401d-aa5e-1a2fc1bf28ed

Now we will get the product

  • Log in to your Postman and create a new workspace.
  • Create a new GET with this URL:
https://www.wixapis.com/stores/v1/products/61ea866c-1564-401d-aa5e-1a2fc1bf28edCode language: JavaScript (javascript)

{id} = Product ID.

-HEADER:  ‘Authorization: <ACCESS TOKEN>’

Get the product using Postman with Wix API

Click Send 

Response: 

  • As you can see, the Postman returned the result like this. Remember to copy this ID for the next step.
Get the product using Postman with Wix API

Inventory Item ID: 9e157993-ea9b-bfe2-55a1-e5d03e40d712

Finally, we will get inventory variants using Postman.

  • In Postman, create a new workspace
  • Create a new POST with this URL:
https://www.wixapis.com/stores/v2/inventoryItems/9e157993-ea9b-bfe2-55a1-e5d03e40d712/getVariants  Code language: JavaScript (javascript)

{inventoryId}: inventory item ID

-HEADER:  ‘Authorization: <ACCESS TOKEN>’

In the body, enter the code.

Payload:

{} } Code language: CSS (css)
  • Click Send

Response:

{
    "inventoryItem": {
        "id": "9e157993-ea9b-bfe2-55a1-e5d03e40d712",
        "externalId": "61ea866c-1564-401d-aa5e-1a2fc1bf28ed",
        "productId": "61ea866c-1564-401d-aa5e-1a2fc1bf28ed",
        "trackQuantity": false,
        "variants": [{
                "variantId": "8f68e87a-ce96-4db4-96d5-b7f363f04249",
                "inStock": true,
                "availableForPreorder": false
            },
            {
                "variantId": "d22f3a71-cff2-4591-b022-a6f7118db9fd",
                "inStock": true,
                "availableForPreorder": false
            },
            {
                "variantId": "57536a3a-ba7a-41fe-aeff-5a03733b4b43",
                "inStock": true,
                "availableForPreorder": false
            },
            {
                "variantId": "d2ba149d-2386-4e31-b5af-38711bc73581",
                "inStock": true,
                "availableForPreorder": false
            },
            {
                "variantId": "a4e40e55-d5c1-4e29-82fe-9dc5dd230212",
                "inStock": true,
                "availableForPreorder": false
            },
            {
                "variantId": "0555e721-9155-405e-a680-d7656cf872d2",
                "inStock": true,
                "availableForPreorder": false
            },
            {
                "variantId": "20837ac4-39be-4e97-a754-642095a58d64",
                "inStock": true,
                "availableForPreorder": false
            },
            {
                "variantId": "3fc02e16-8a7c-4588-99dd-199921b62cfd",
                "inStock": true,
                "availableForPreorder": false
            }
        ],
        "lastUpdated": "2022-08-31T14:23:13.563Z",
        "numericId": "1654705207181000",
        "preorderInfo": {
            "enabled": false
        }
    }
}Code language: JSON / JSON with Comments (json)

As you can see, the Postman returned all inventory variants of the product.

The above are steps to get inventory variants 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 get inventory variants
beehexa infor how to get inventory variants 01

Or you can watch this video for more overview.

Wix API – How to get inventory variants using Postman

Hopefully, you can do it!

Table of Contents

Ready to integrate and automate at scale ?

Learn how HexaSync lets you build enterprise-grade integrations and automations without having to code.

Receive Exclusive Productivity Tips Directly in Your Inbox

We’ll email you 1-3 times per week—and never share your information.

Get started for free

You can’t add more hours to the day. Beehexa is the next best thing.