Requirements to create REST API for mobile apps in woocommerce:

  • To use the latest version of the REST API you must be using on the woocommerce.
  • WooCommerce 2.6+.
  • 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.

Authentication:

  • WooCommerce includes two ways to authenticate with the WP REST API. It is also possible to authenticate using any WP REST API authentication plugin or method.

Steps to Generating API keys in the WordPress admin :

  • To create or manage keys for a specific WordPress user, go to WooCommerce > Settings > API > Keys/Apps.

woocommerce

  • Click the “Add Key” button. In the next screen, add a description and select the WordPress user you would like to generate the key for.
  • Choose the level of access for this REST API key, which can be Read access, Write access or Read/Write access.

woocommerce

  • Then click the “Generate API Key” button and WooCommerce will generate REST API keys for the selected user.
  • Now that keys have been generated, you should see two new keys, a QRCode, and a revoke API key button. These two keys are your Consumer Key and Consumer Secret.

woocommerce

Author: Venkata Saikumar Bitta

Web Developer