WooCommerce (WC) 2.6+ is fully integrated with the WordPress REST API. This allows WC data to be created, read, updated, and deleted using requests in JSON format and using WordPress REST API Authentication methods and standard HTTP verbs which are understood by most HTTP clients.
The current WP REST API integration version is
v3 which takes a first-order position in endpoints.
|API Version||WC Version||WP Version||Documentation|
||3.5.x or later||4.4 or later||–|
||3.0.x or later||4.4 or later||v2 docs|
||2.6.x or later||4.4 or later||v1 docs|
- WooCommerce 3.5+.
- WordPress 4.4+.
- Pretty permalinks in
Settings > Permalinksso that the custom endpoints are supported. Default permalinks will not work.
- You may access the API over either HTTP or HTTPS, but HTTPS is recommended where possible.
The default response format is JSON. Requests with a message-body use plain JSON to set or update resource attributes. Successful requests will return a
200 OK HTTP status.
Some general information about responses:
- Dates are returned in ISO8601 format:
- Resource IDs are returned as integers.
- Any decimal monetary amount, such as prices or totals, will be returned as strings with two decimal places.
- Other amounts, such as item counts, are returned as integers.
- Blank fields are generally included as
nullor emtpy string instead of being omitted.
Occasionally you might encounter errors when accessing the REST API. There are four possible types:
|Error Code||Error Type|
||Invalid request, e.g. using an unsupported HTTP method|
||Authentication or permission error, e.g. incorrect API keys|
||Requests to resources that don’t exist or are missing|
URL : domain_name/wp-json/wpem-auth/
Example : https://example.com/wp-json/wpem-auth/
Get Authentication key
You will get the Consumer key and Consumer secret by using the App key.
HTTP request :
Method : GET
NOTE : The consumer_key and consumer_secret returned by the above API must be needed as authentication to call below all APIs.