Table of Contents
Note #
- ‘WooCommerce Store API‘ and ‘WooCommerce REST API‘ will be used synonymously.
- When viewing example links in this document, remember that the ‘wpovernight.local‘ part must be replaced by your own site’s domain.

Activate WooCommerce REST API #
Path: WooCommerce > Settings > Advanced > REST API.
Our postcode checker plugin uses the WooCommerce REST API in order to provide address validation functionality via REST API.
- Generate a REST API key at WooCommerce > Settings > Advanced > REST API > Add key button.

- Set the user of the key to any user with admin access.
- After the key is created, it is important to remember the Consumer key and Consumer secret – since those 2 credentials are used in order to perform authentication using:
- Basic authorization
- OAuth 1.0 authorization
Enable Postcode Checker REST API endpoint #
Path: WooCommerce > Postcode Checker > Enable REST API endpoint.
This setting will be disabled by default.

Samples #
rest-collection-v1.3.json file (Postman used):
{
"info": {
"_postman_id": "f4da27fd-38ab-4b3b-b65f-344660878dc3",
"name": "WooCommerce Postcode Checker API",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "4754164"
},
"item": [
{
"name": "Check postcode",
"request": {
"auth": {
"type": "oauth1",
"oauth1": [
{
"key": "consumerSecret",
"value": "",
"type": "string"
},
{
"key": "consumerKey",
"value": "",
"type": "string"
},
{
"key": "signatureMethod",
"value": "HMAC-SHA1",
"type": "string"
},
{
"key": "version",
"value": "1.0",
"type": "string"
},
{
"key": "addParamsToHeader",
"value": false,
"type": "boolean"
},
{
"key": "addEmptyParamsToSign",
"value": false,
"type": "boolean"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "http://wpovernight.local/wp-json/wc/wpo/wcpc/v1/wc-postcode-checker?house_number=30&postcode=2012ES",
"protocol": "http",
"host": [
"wpovernight",
"local"
],
"path": [
"wp-json",
"wc",
"wpo",
"wcpc",
"v1",
"wc-postcode-checker"
],
"query": [
{
"key": "house_number",
"value": "30"
},
{
"key": "postcode",
"value": "2012ES"
}
]
}
},
"response": []
}
]
}Check address #
GET
http://wpovernight.local/wp-json/wc/wpo/wcpc/v1/wc-postcode-checker?house_number=30&postcode=2012ESJSON response example:
{
"address":
{
"postcode": "2012ES",
"housenumber": "30",
"housenumber_suffix": "",
"street": "Julianastraat",
"city": "Haarlem",
"data":
{
"street": "Julianastraat",
"city": "Haarlem"
}
}
}Body form data:
| Parameter | Type | Description |
|---|---|---|
| house_number | string | House number |
| postcode | string | Postcode number |
Troubleshooting #
- If you get the following error, try changing the authorization scheme from ‘OAuth 1.0‘ to ‘Basic‘.
{
"code": "woocommerce_rest_authentication_error",
"message": "Invalid signature - provided signature does not match.",
"data": {
"status": 401
}
}- Make sure to enable the Postcode checker REST API endpoint setting.