• Resolved tarig

    (@tarig)


    Hi,

    I have migrated my website from temporarly used Windows Server to new Apache Linux Server, but after migration and when i try to make GET request for Products, Orders…, etc i get 401 response.

    On the dashboard side i get below errors when i go to Products page:

    Notice: register_rest_route was called incorrectly. The REST API route definition for wc/v3/ams-menu is missing the required permission_callback argument. For REST API routes that are intended to be public, use __return_true as the permission callback. Please see Debugging in WordPress for more information. (This message was added in version 5.5.0.) in public_html/wp-includes/functions.php on line 5225

    Notice: register_rest_route was called incorrectly. The REST API route definition for wc/v3/ams-menu-names is missing the required permission_callback argument. For REST API routes that are intended to be public, use __return_true as the permission callback. Please see Debugging in WordPress for more information. (This message was added in version 5.5.0.) in public_html/wp-includes/functions.php on line 5225

    Notice: register_rest_route was called incorrectly. The REST API route definition for wc/v3/ams-login is missing the required permission_callback argument. For REST API routes that are intended to be public, use __return_true as the permission callback. Please see Debugging in WordPress for more information. (This message was added in version 5.5.0.) in public_html/wp-includes/functions.php on line 5225

    Notice: register_rest_route was called incorrectly. The REST API route definition for wc/v3/ams-verify-user is missing the required permission_callback argument. For REST API routes that are intended to be public, use __return_true as the permission callback. Please see Debugging in WordPress for more information. (This message was added in version 5.5.0.) in public_html/wp-includes/functions.php on line 5225

    Notice: register_rest_route was called incorrectly. The REST API route definition for wc/v3/ams-profile-meta is missing the required permission_callback argument. For REST API routes that are intended to be public, use __return_true as the permission callback. Please see Debugging in WordPress for more information. (This message was added in version 5.5.0.) in public_html/wp-includes/functions.php on line 5225

    Notice: register_rest_route was called incorrectly. The REST API route definition for wc/v3/ams-order-payment-url is missing the required permission_callback argument. For REST API routes that are intended to be public, use __return_true as the permission callback. Please see Debugging in WordPress for more information. (This message was added in version 5.5.0.) in public_html/wp-includes/functions.php on line 5225

    Notice: register_rest_route was called incorrectly. The REST API route definition for wc/v3/ams-order-total is missing the required permission_callback argument. For REST API routes that are intended to be public, use __return_true as the permission callback. Please see Debugging in WordPress for more information. (This message was added in version 5.5.0.) in public_html/wp-includes/functions.php on line 5225

    Notice: register_rest_route was called incorrectly. The REST API route definition for wc/v3/ams-send-password-reset-link is missing the required permission_callback argument. For REST API routes that are intended to be public, use __return_true as the permission callback. Please see Debugging in WordPress for more information. (This message was added in version 5.5.0.) in public_html/wp-includes/functions.php on line 5225

    Notice: register_rest_route was called incorrectly. The REST API route definition for wc/v3/ams-applicable-shipping-method is missing the required permission_callback argument. For REST API routes that are intended to be public, use __return_true as the permission callback. Please see Debugging in WordPress for more information. (This message was added in version 5.5.0.) in public_html/wp-includes/functions.php on line 5225

    Notice: register_rest_route was called incorrectly. The REST API route definition for wc/v3/ams-product-search is missing the required permission_callback argument. For REST API routes that are intended to be public, use __return_true as the permission callback. Please see Debugging in WordPress for more information. (This message was added in version 5.5.0.) in public_html/wp-includes/functions.php on line 5225

    Notice: register_rest_route was called incorrectly. The REST API route definition for wc/v3/ams-verify-cart-items is missing the required permission_callback argument. For REST API routes that are intended to be public, use __return_true as the permission callback. Please see Debugging in WordPress for more information. (This message was added in version 5.5.0.) in public_html/wp-includes/functions.php on line 5225

    Notice: register_rest_route was called incorrectly. The REST API route definition for wc/v3/ams-categories is missing the required permission_callback argument. For REST API routes that are intended to be public, use __return_true as the permission callback. Please see Debugging in WordPress for more information. (This message was added in version 5.5.0.) in public_html/wp-includes/functions.php on line 5225

    Notice: register_rest_route was called incorrectly. The REST API route definition for wc/v3/ams-post-categories is missing the required permission_callback argument. For REST API routes that are intended to be public, use __return_true as the permission callback. Please see Debugging in WordPress for more information. (This message was added in version 5.5.0.) in public_html/wp-includes/functions.php on line 5225

    I tried alot to fix it but unfortunately i did not succeed, any one can healp please!

    Thanks in advance.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Stuart Duff – a11n

    (@stuartduff)

    Automattic Happiness Engineer

    Hi @tarig,

    A 401 response from the WooCommerce REST API is indicating that you’re not correct authorized to view or pass data to that particular API endpoint. This blog post below should help you check your API access credentials.

    https://www.schakko.de/2020/09/05/fixing-http-401-unauthorized-when-calling-woocommerces-rest-api/

    With regards to the WooCommerce REST API access codes themselves those can be set from inside your WooCommerce site by following this documentaiton.

    https://docs.woocommerce.com/document/woocommerce-rest-api/

    For the developer level documentation, you can find located on this site below and this covers authentication and all of the endpoints and parameters which can be accessed via the REST API.

    https://woocommerce.github.io/woocommerce-rest-api-docs/#introduction

    With regards to testing API calls, we have some information on testing API calls using an App called Postman and I’ve referenced that for you below too.

    https://github.com/woocommerce/woocommerce/wiki/Getting-started-with-the-REST-API

    Thread Starter tarig

    (@tarig)

    Thank you @stuartduff .

    I have noticed that when i teszt with
    Postman i get
    ` “code”: “rest_no_route”,
    “message”: “No route was found matching the URL and request method”,
    “data”: {
    “status”: 404`

    When i checked wp-json i have noticed routes has no entries, how can i set these routes?:

    {
        "name": "Goff",
        "description": "Fresh Veg. & Fruits",
        "url": "https://goffa.sd",
        "home": "https://goffa.sd",
        "gmt_offset": "2",
        "timezone_string": "",
        "namespaces": [
            "wp/v2",
            "oembed/1.0",
            "wc/v3",
            "contact-form-7/v1",
            "wpml/st/v1",
            "wc/store",
            "wc-analytics",
            "wc-admin",
            "wc/v1",
            "wc/v2",
            "wccom-site/v1",
            "otgs/installer/v1"
        ],
        "authentication": {
            "oauth1": {
                "request": "https://goffa.sd/oauth1/request",
                "authorize": "https://goffa.sd/oauth1/authorize",
                "access": "https://goffa.sd/oauth1/access",
                "version": "0.1"
            }
        },
        "routes": {
            "/": {
                "namespace": "",
                "methods": [
                    "GET"
                ],
                "endpoints": [
                    {
                        "methods": [
                            "GET"
                        ],
                        "args": {
                            "context": {
                                "required": false,
                                "default": "view"
                            }
                        }
                    }
                ],
                "_links": {
                    "self": [
                        {
    Plugin Support Stuart Duff – a11n

    (@stuartduff)

    Automattic Happiness Engineer

    Hey @tarig,

    When looking at your initial post I noticed a lot of the rest routes you mentioned begin with ams like ams-someothertext. These API endpoints are not part of the default WooCommerce plugin and could either be endpoints you’ve added yourself using custom code or are being added by another plugin installed on your site.

    Try resaving your WordPress site’s permalinks from Settings > Permalinks. If that does not work I would suggest you investigate what has added these API endpoints to your site and contact that plugin developer.

    By default, the only REST API endpoints included within the WooCommerce plugin itself are the ones listed within the developer documentation.

    https://woocommerce.github.io/woocommerce-rest-api-docs/#introduction

    I hope this helps.

    Plugin Support mouli a11n

    (@mouli)

    It’s been a while since we heard from you, so I’m marking this thread resolved. Hopefully, you’ve been able to resolve this, but if you haven’t, please open up a new topic and we’ll be happy to help out.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Authorization response 401 – Woocommerce API’ is closed to new replies.