Abdullq
Abdullq

Reputation: 69

How to authenticate WooCommerce REST API

I have generated the consumer key and consumer secret but I don't know how to aply it to authenticate on Postman. This is the screenshot below:

screenshot from 2016-08-17 14-28-18

The url looks like this: https://mystore.com/wp-json/wc/v1/coupons?oauth_consumer_key=ck_XXXXXXXXXXXXXXX&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1471440398&oauth_nonce=Qaq8cK&oauth_version=1.0&oauth_signature=XXXXXXXXXXXXXXXXXXXXXXXXXw=

But this is returning error 401:

{ "code": "woocommerce_rest_cannot_view", "message": "Sorry, you cannot list resources.", "data": { "status": 401 } } I have read the the documentation but it didn't show any examples.

Upvotes: 0

Views: 2666

Answers (1)

Aurelia
Aurelia

Reputation: 1062

You can send your credentials via Authentication header if your site runs on HTTPS (it should if you're running WooCommerce).

Here's the relevant part of the docs:
https://woothemes.github.io/woocommerce-rest-api-docs/?shell#authentication-over-https

Upvotes: 1

Related Questions