Wix API - How to get product options available using Postman

Wix API – How To Get Product Options Availability

In Wix API, you can use Postman to get product options available based on product 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/access
Code language: JavaScript (javascript)
get the access token in Wix API
Wix API - How To Get Product Options Availability 8
  • 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
body_get the access token in Wix API
Wix API - How To Get Product Options Availability 9
  • Then click SEND

Response:

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

response_get the access token in Wix API
Wix API - How To Get Product Options Availability 10

Step 3: Get product options availability

Before getting product options available, we will get the product ID because that parameter includes in the next call. 

  • From Wix dashboard
  • Go to “Store products”
  • Click on “Products”
  • Then click on the product that you want to get the product ID.
  • Finally, copy the product ID in the URL. 

We will rely on the product ID and a product option to get the product options available. 

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

Product option = “Size”: “Small”

Now, we will get the product options available.

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

{id} = Product ID.

-HEADER:  ‘Authorization: <ACCESS TOKEN>’

Wix API - Get product options available using Postman
Wix API - How To Get Product Options Availability 11

In the body, enter the code.

Payload:

{ "options": { "Size": "Small" } }
Code language: JSON / JSON with Comments (json)
body_Wix API How to get product options available using Postman
Wix API - How To Get Product Options Availability 12

Click send

Response: 

As you can see, the Postman returned the product options availability like this.

{ "productOptions": [ { "optionType": "drop_down", "name": "Size", "choices": [ { "value": "S", "description": "Small", "inStock": true, "visible": true }, { "value": "Large", "description": "Large", "inStock": true, "visible": true }, { "value": "Medium", "description": "Medium", "inStock": true, "visible": true }, { "value": "One size", "description": "One size", "inStock": true, "visible": true } ] }, { "optionType": "color", "name": "Color", "choices": [ { "value": "rgb(0, 0, 0)", "description": "Black", "inStock": true, "visible": true }, { "value": "rgb(255, 255, 255)", "description": "White", "inStock": true, "visible": true } ] } ], "availableForPurchase": false, "managedProduct": true }
Code language: JSON / JSON with Comments (json)
response_Wix API How to get product options available using Postman
Wix API - How To Get Product Options Availability 13

The above are all steps to Get Product Options Available using Postman with Wix API. In the next article, we 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.

Get Product Options Available using Postman with Wix API
Wix API - How To Get Product Options Availability 14

Or you can watch this video for more overview.

Wix API – How to get product option availability

Hopefully, you can do it!