"cannot list resources" error from WooCommerce REST API "cannot list resources" error from WooCommerce REST API wordpress wordpress

"cannot list resources" error from WooCommerce REST API


Authentication Methods

For the newer v3 API (not the "legacy" APIs):

  • For secure connections (HTTPS), you need to use "Basic Authentication".
  • For non-secure connections (HTTP), you need to use "oAuth1 Authentication".

If you use the wrong authentication with the wrong connection, you'll get the 401 response message.

This is covered in the WooCommerce API documentation:https://woocommerce.github.io/woocommerce-rest-api-docs/#authentication-over-https

API login username and password(also "Consumer key is missing" error)

Normally you would pass the CK and CS in as header fields, but depending on how the server is configured, you may find that it will not parse the header fields correctly, so you may get success if you include the CK and CS in the URL as parameters:

https://website.tld/wp-json/wc/v1/products?consumer_key=[key]&consumer_secret=[secret]

Apache authorization variable

You may need to fill the authorization variable in Apacheif you use FCGId. In your .htaccess or sites sections, add this :

<IfModule mod_fcgid.c>RewriteCond %{HTTP:Authorization} .RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]</IfModule>

(https://fuelphp.com/forums/discussion/12825/rest-authentication-does-not-work-under-default-cgi-configurations-solution-within/p1)


You are getting a 401 response from the server. This response indicates the you are not authorized for that REST endpoint. In order to use the woocommerce api you need to include your authorization in the request.

There are examples and documentation here:http://woocommerce.github.io/woocommerce-rest-api-docs/#authentication

The woocommerce examples don't include java examples. (I assume that is what you are using for your android app). However there is a 3rd party java library for woocommerce. It can be found here:https://github.com/icoderman/wc-api-java

I have not personally used that library, but it should contain all the functions you will need to authorize and correctly request data from the woocommerce api.


For future Googlers... I needed to added this to my .htaccess

Needed for WooCommerce API

RewriteRule ^index.php$ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]