Prerequisites
- WooCommerce API Keys: You need Consumer Key and Consumer Secret.
- Base URL: Replace
https://yourstore.comwith your actual WooCommerce store URL. - Authorization: Basic Auth with your Consumer Key and Consumer Secret.
Authorization Setup in Postman
- Go to the Authorization tab.
- Select Type: Basic Auth.
- Username: Enter your Consumer Key.
- Password: Enter your Consumer Secret.
1. List Categories
- URL:
https://yourstore.com/wp-json/wc/v3/products/categories - Method: GET
- Headers:
Authorization: Basic Auth
Example in Postman:
- Set method to GET.
- Enter URL:
https://yourstore.com/wp-json/wc/v3/products/categories - Go to the Authorization tab and set Type to Basic Auth.
- Enter Consumer Key and Consumer Secret.
- Send the request.
2. Retrieve a Category
- URL:
https://yourstore.com/wp-json/wc/v3/products/categories/{id} - Method: GET
- Headers:
Authorization: Basic Auth
- Replace
{id}with the actual category ID.
Example in Postman:
- Set method to GET.
- Enter URL:
https://yourstore.com/wp-json/wc/v3/products/categories/{id} - Go to the Authorization tab and set Type to Basic Auth.
- Enter Consumer Key and Consumer Secret.
- Send the request.
3. Create a Category
- URL:
https://yourstore.com/wp-json/wc/v3/products/categories - Method: POST
- Headers:
Authorization: Basic Auth
- Body: JSON with category data.
Example JSON Body:
{
"name": "New Category",
"slug": "new-category",
"description": "This is a new category",
"parent": 0
}
Example in Postman:
- Set method to POST.
- Enter URL:
https://yourstore.com/wp-json/wc/v3/products/categories - Go to the Authorization tab and set Type to Basic Auth.
- Enter Consumer Key and Consumer Secret.
- Go to the Body tab, select
raw, chooseJSONfrom the dropdown, and paste the example JSON body. - Send the request.
4. Update a Category
- URL:
https://yourstore.com/wp-json/wc/v3/products/categories/{id} - Method: PUT
- Headers:
Authorization: Basic Auth
- Body: JSON with updated category data.
- Replace
{id}with the actual category ID.
Example JSON Body:
{
"name": "Updated Category",
"description": "This is the updated category description"
}
Example in Postman:
- Set method to PUT.
- Enter URL:
https://yourstore.com/wp-json/wc/v3/products/categories/{id} - Go to the Authorization tab and set Type to Basic Auth.
- Enter Consumer Key and Consumer Secret.
- Go to the Body tab, select
raw, chooseJSONfrom the dropdown, and paste the example JSON body. - Send the request.
5. Delete a Category
- URL:
https://yourstore.com/wp-json/wc/v3/products/categories/{id} - Method: DELETE
- Headers:
Authorization: Basic Auth
- Replace
{id}with the actual category ID.
Example in Postman:
- Set method to DELETE.
- Enter URL:
https://yourstore.com/wp-json/wc/v3/products/categories/{id} - Go to the Authorization tab and set Type to Basic Auth.
- Enter Consumer Key and Consumer Secret.
- Send the request.
6. Batch Update Categories
- URL:
https://yourstore.com/wp-json/wc/v3/products/categories/batch - Method: POST
- Headers:
Authorization: Basic Auth
- Body: JSON with batch operations.
Example JSON Body:
{
"update": [
{
"id": 1,
"name": "Updated Category 1"
},
{
"id": 2,
"description": "Updated description for category 2"
}
]
}
Example in Postman:
- Set method to POST.
- Enter URL:
https://yourstore.com/wp-json/wc/v3/products/categories/batch - Go to the Authorization tab and set Type to Basic Auth.
- Enter Consumer Key and Consumer Secret.
- Go to the Body tab, select
raw, chooseJSONfrom the dropdown, and paste the example JSON body. - Send the request.
By following these instructions, you can test each WooCommerce categories endpoint in Postman. Each request should include the necessary Authorization header configured through Basic Auth with your Consumer Key and Consumer Secret.