fbpx
Did you miss our exclusive webinar on Attendee information? Click here to view the recorded session.
How can we help?

Introduction

Introduction

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

Requirements

  • WooCommerce 3.5+.
  • WordPress 4.4+.
  • Pretty permalinks in Settings > Permalinks so 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.

Request/Response Format

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: YYYY-MM-DDTHH:MM:SS
  • 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 null or emtpy string instead of being omitted.

Errors

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/

Get Authentication key

You will get the Consumer key and Consumer secret by using the App key.

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 :
Get Authentication Key

Introduction
Editorial Team

Our team constantly explores ways that technology can help us reinvent industries. We want to change the world by creating great products that transform industries. We Dream It, We Make It.

Quick Links
Close
Close