• Resolved prinoch

    (@prinoch)


    please i have issues with REST API when we use your API, i get the following error, could you tell me the reason of the error if the API key is correct?

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

    store url:pwear.tk

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Grigorij S. a11n

    (@grigaswp)

    Hi @prinoch ,

    Thank you for reaching out!

    I understand that you are getting a 401 response from the server. This usually indicates that you are not authorized for that REST endpoint. In order to use the WooCommerce API, you need to include your authorization in the request.

    For the v2 and v3 API:

    For secure connections (HTTPS), you need to use “Basic Authentication”.
    For non-secure connections (HTTP), you need to use “oAuth1 Authentication”.
    These are not interchangeable, which means if you’ll use basic authentication with HTTP or oAuth1 Authentication with HTTPS – that will not work.

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

    Also, note that normally you would pass the Customer Key and Customer Secret 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.com/wp-json/wc/v1/products?consumer_key=%5Bkey%5D&consumer_secret=%5Bsecret%5D

    I hope this helps!

    Thread Starter prinoch

    (@prinoch)

    good day,thanks for reply. honestly i do not understand how to go about those steps at all…please is another way i could get assistance

    Thomas Shellberg

    (@shellbeezy)

    Automattic Happiness Engineer

    Hey @prinoch,

    Usage of the WooCommerce REST API requires not only experience with programming languages but also with JSON and using APIs in general. Because of the advanced requirements of using the REST API it’s geared more towards experienced developers. If you are not a developer and need to use the REST API with your own code it’s recommended to hire a developer for the work you are doing.

    If you are using a third-party integration which utilizes the REST API it’s best to get help with the third-party integration service to make sure the API user is working and has the proper permissions.

    Plugin Support Tseten a11n

    (@tibetanitech)

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘REST API PROBLEM’ is closed to new replies.