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 Customers
- URL:
https://yourstore.com/wp-json/wc/v3/customers - Method: GET
- Headers:
Authorization: Basic Auth
Example in Postman:
- Set method to GET.
- Enter URL:
https://yourstore.com/wp-json/wc/v3/customers - Go to the Authorization tab and set Type to Basic Auth.
- Enter Consumer Key and Consumer Secret.
- Send the request.
2. Retrieve a Customer
- URL:
https://yourstore.com/wp-json/wc/v3/customers/{id} - Method: GET
- Headers:
Authorization: Basic Auth
- Replace
{id}with the actual customer ID.
Example in Postman:
- Set method to GET.
- Enter URL:
https://yourstore.com/wp-json/wc/v3/customers/{id} - Go to the Authorization tab and set Type to Basic Auth.
- Enter Consumer Key and Consumer Secret.
- Send the request.
3. Create a Customer
- URL:
https://yourstore.com/wp-json/wc/v3/customers - Method: POST
- Headers:
Authorization: Basic Auth
- Body: JSON with customer data.
Example JSON Body:
{
"email": "john.doe@example.com",
"first_name": "John",
"last_name": "Doe",
"username": "john.doe",
"billing": {
"first_name": "John",
"last_name": "Doe",
"company": "",
"address_1": "123 Main St",
"address_2": "",
"city": "Anytown",
"state": "CA",
"postcode": "12345",
"country": "US",
"email": "john.doe@example.com",
"phone": "(555) 555-5555"
},
"shipping": {
"first_name": "John",
"last_name": "Doe",
"company": "",
"address_1": "123 Main St",
"address_2": "",
"city": "Anytown",
"state": "CA",
"postcode": "12345",
"country": "US"
}
}
Example in Postman:
- Set method to POST.
- Enter URL:
https://yourstore.com/wp-json/wc/v3/customers - 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 Customer
- URL:
https://yourstore.com/wp-json/wc/v3/customers/{id} - Method: PUT
- Headers:
Authorization: Basic Auth
- Body: JSON with updated customer data.
- Replace
{id}with the actual customer ID.
Example JSON Body:
{
"first_name": "Jane",
"last_name": "Doe",
"billing": {
"first_name": "Jane",
"last_name": "Doe",
"address_1": "456 Another St",
"city": "New City",
"state": "NY",
"postcode": "67890",
"country": "US",
"email": "jane.doe@example.com",
"phone": "(555) 555-1234"
},
"shipping": {
"first_name": "Jane",
"last_name": "Doe",
"address_1": "456 Another St",
"city": "New City",
"state": "NY",
"postcode": "67890",
"country": "US"
}
}
Example in Postman:
- Set method to PUT.
- Enter URL:
https://yourstore.com/wp-json/wc/v3/customers/{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 Customer
- URL:
https://yourstore.com/wp-json/wc/v3/customers/{id} - Method: DELETE
- Headers:
Authorization: Basic Auth
- Replace
{id}with the actual customer ID.
Example in Postman:
- Set method to DELETE.
- Enter URL:
https://yourstore.com/wp-json/wc/v3/customers/{id} - Go to the Authorization tab and set Type to Basic Auth.
- Enter Consumer Key and Consumer Secret.
- Send the request.
6. Batch Update Customers
- URL:
https://yourstore.com/wp-json/wc/v3/customers/batch - Method: POST
- Headers:
Authorization: Basic Auth
- Body: JSON with batch operations.
Example JSON Body:
{
"update": [
{
"id": 1,
"first_name": "Updated",
"last_name": "Name"
},
{
"id": 2,
"billing": {
"phone": "(555) 555-6789"
}
}
]
}
Example in Postman:
- Set method to POST.
- Enter URL:
https://yourstore.com/wp-json/wc/v3/customers/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 customers endpoint in Postman. Each request should include the necessary Authorization header configured through Basic Auth with your Consumer Key and Consumer Secret.