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 |
---|---|---|---|
v3 | 3.5.x or later | 4.4 or later | – |
v2 | 3.0.x or later | 4.4 or later | v2 docs |
v1 | 2.6.x or later | 4.4 or later | v1 docs |
Settings > Permalinks
so that the custom endpoints are supported. Default permalinks will not work.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:
YYYY-MM-DDTHH:MM:SS
null
or 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 |
---|---|
400 Bad Request | Invalid request, e.g. using an unsupported HTTP method |
401 Unauthorized | Authentication or permission error, e.g. incorrect API keys |
404 Not Found | Requests to resources that don’t exist or are missing |
500 Internal Server Error | Server error |
URL : domain_name/wp-json/wpem-auth/
Example : https://example.com/wp-json/wpem-auth/
You will get the Consumer key and Consumer secret by using the App key.
HTTP request :
Method : GET
URL : https://app.wp-eventmanager.com/wp-json/wpem-auth/appkey?key=2576040397
Response :
{
“key_id”: “36”,
“app_key”: “2576040397”,
“user_id”: “1”,
“permissions”: “read_write”,
“consumer_key”: “ck_8609fcd78ca0dc8afac82f03bc7a6e78d6b686c9”,
“consumer_secret”: “cs_13a807221f46cc4b6e15aa7c684212c2de70f8a4”,
“nonces”: null
}
NOTE : The consumer_key and consumer_secret returned by the above API must be needed as authentication to call below all APIs.
Example :