Jonny B'Good
Jonny B'Good

Reputation: 123

Woocommerce REST API https - Cannot Connect

Connecting to WooCommerce API, HTTP have no problems.

When I change the permalinks from http to https then try to connect using the https url I get:

{
  "code": "woocommerce_rest_cannot_view",
  "message": "Sorry, you cannot list resources.",
  "data": {
    "status": 401
  }
}

I have an SSL cert, so I'm not sure why it won't work?

Please help,

Many thanks!

EDIT: Request: HTTP enter image description here enter image description here

enter image description here

HTTPS

https postman req

https postman fail woocommerce https

Upvotes: 2

Views: 4101

Answers (1)

Skatox
Skatox

Reputation: 4284

According to WooCommerce REST API documentation:

Occasionally some servers may not parse the Authorization header correctly (if you see a “Consumer key is missing” error when authenticating over SSL, you have a server issue). In this case, you may provide the consumer key/secret as query string parameters instead.

Check that orders parameters are in the same order as examples, no space. Or I would use basic HTTPS authentication, that's how I comunicate using https:

https://localhost/wp-json/wc/v1/orders?consumer_key=ck_xxxxxxxxxxxxxx&consumer_secret=xxxxxxxxxxxxxxx

Upvotes: 3

Related Questions