• Resolved Matt

    (@mattsaay)


    Hi

    I realize that are many posts with same problem, which I went through. Still I could not find any resolve. For this reason I’m including as much info of my situation as possible.

    My situation:
    I’m trying to post Categories to the WooCommerce API.

    My environment (Windows 10):
    XAMPP v8.1.6
    XAMPP Control Panel v3.3.0
    WordPress version: 6.0
    WooCommerce version: 6.5.1
    WooCommerce REST API package: 6.5.1
    PHP version: 8.1.6
    MySQL version: 10.4.24-MariaD
    API Key Access read and write

    JSON Call:
    {“parent”:””,”slug”:”ladies”,”name”:”Ladies”,”description”:”Ladies”,”display”:”default”}

    JSON Response:
    {“code”:”woocommerce_rest_cannot_create”,”message”:” “,”data”:{“status”:401}} orry, you are not allowed to create resources.

    .htaccess:
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule .* – [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteBase /myshop/wordpress/
    # RewriteRule ^index\.php$ – [L]
    RewriteRule ^index\.php$ – [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /myshop/wordpress/index.php [L]
    </IfModule>

    # END WordPress

    Please Help

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support nicw.a11n

    (@nicw)

    Hi @mattsaay

    I was able to successful POST your data to /wp-json/wc/v3/products/categories and create a category.

    {"parent":"0","slug":"ladies","name":"Ladies","description":"Ladies","display":"default"}

    One issue I had was the encoding of your " markup.

    However, I do not believe this is the actual cause of your problem. The 401 response indicates that you have a permissions error. The unable to find resource indicates a possible issue with your server rejecting POST requests, rather than a problem with your API key and secret, which return errors of their own.

    I am working with local, however, not XAMPP.

    I would start by making sure the local server is responding correctly to POST requests to the WordPress API endpoints, and work on from there.

    We’ve not heard back from you, so I’m marking this thread as resolved. Hopefully, the above info was helpful.

    If you have further questions, please feel free to open a new topic.

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

The topic ‘woocommerce_rest_cannot_create’ is closed to new replies.