WooCommerce REST API Error 403 woocommerce_rest_cannot_view [Fix]

WooCommerce REST API can be used to add, delete, and update products, customers, coupons, orders, etc. In order to develop a React Native based Android application, I generated a REST API key in WooCommerce and used Postman (the API client) to test if the API is working properly. However, the API client ended up throwing the 403 error – woocommerce_rest_cannot_view with the message Sorry, you cannot list resources. Below is the Pretty view of the error message.

{

    "code": "woocommerce_rest_cannot_view",

    "message": "Sorry, you cannot list resources.",

    "data": {

        "status": 403

    }

}

If you are getting this error, then here’s the fix.

How to fix 403 woocommerce_rest_cannot_view

403 error generally means that the server could find the resource, but unable to grant access to the requested resource for some reason. Usually, it’s called “Forbidden access” error. Said that the API endpoint was found, the API keys/credentials used for authentication were successful, but the account or user for which APIs were generated was not authorized to request the resource. Hence, the server returned a 403 error.

A quick look at the roles and capabilities of WooCommerce tells us that there are two roles – the Shop Manager and Customer. The error “403 woocommerce_rest_cannot_view” occurred due to the insufficient privilege for the user. To fix the issue, I created API keys for the user who has privileges to access the requested resource – that’s the user with the ‘Shop Manager’ role.

Updated on June 12, 2020

Was this article helpful?

Related Articles

Leave a Comment