This article will show you how to delete a product category from Wix using Postman.
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 |
- 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:
NAME | TYPE | DESCRIPTION |
grant_type | string | Value must be set to โrefresh_tokenโ |
client_id | string | The App ID as defined in the Wix Developers Center |
client_secret | string | The Secret Key for your app as defined in your Wix Developers Center |
refresh_token | string | The refresh token issued with the access token |
- Then click SEND
Response:
The Postman will return the new access token and the refresh token in order to request a new access token.ย
Step 3: Delete a product category using Postman
Now I will check if this category is in Wix or not.
- Go to the Wix dashboard
- Choose store products
- Click on categories
As you can see the โT-Shirtโ category is in Wix.
Now, letโs get the category ID because the next call includes that parameter.
There are two ways to get the category ID.
The first way you can copy the ID in the response category of the cataloging command
The second way is to query the category and select the category ID you want to delete.
In this article, I will get it the first way. You can read this blog to know more about that: Wix API 2023 โ How to create a product category using Postman
I have the category ID = 789da22a-23f7-42d9-9578-93dd1e20c836
Now, we will delete a product category using Postman.
- Log in to your Postman and create a new workspace.
- Create a new DELETE with this URL:
https://www.wixapis.com/stores/v1/collections/{id} |
-HEADER:ย ‘Authorization: <ACCESS TOKEN>’
Then, Click send.
Response:
As you can see, the Postman returned the empty array.
Step 4: Verify the result
Now, we will verify the category.
- Go to the Wix dashboard
- Choose store products
- Click on categories
As you can see, the product category has been deleted.
The above steps are to delete a product category 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.
Or you can watch this video for more overview.
Hopefully, you can do it!