Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[API] PUT and POST return "501 Method not implemented" on http connection #9838

Closed
robertslagter opened this issue Dec 12, 2015 · 8 comments
Closed
Labels
needs: author feedback The issue/PR needs a response from any of the parties involved in the issue.

Comments

@robertslagter
Copy link

When trying to perform any PUT or POST command on the REST API (v3) over a http connection, the user receives a "501 Method Not Implemented" error.
The error occurs for instance on updating products (one product or in bulk) using the Python official library, cURL or the PHP library.
GET commands work as intended. Please note that the issue occurs even though the user credentials refer to an admin account, which has read/write access in the WooCommerce API.

The exact error message is:
PUT to /wc-api/v3/products/156 not supported.
(while 156 refers to a valid product id)

@claudiosanches
Copy link
Contributor

I bet that have something in your server changing it, like something in your .htaccess or nginx config.
Many servers have PUT, POST and DELETE blocked for safety.
Please check it.

@WPprodigy WPprodigy added the needs: author feedback The issue/PR needs a response from any of the parties involved in the issue. label Dec 13, 2015
@robertslagter
Copy link
Author

I hope you are right, but it does not seem to be the case.
My .htaccess does not include anything special I think:

RewriteEngine On RewriteBase / RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]

I have asked my provider today, and they do not have any other rewrite or blocking rules running.
Thank you so much for helping, as this is driving me crazy ;-)

@claudiosanches
Copy link
Contributor

Still can be have it in your apache config.
Check it too.

@robertslagter
Copy link
Author

You were right! Thank you so much - my hosting provider had a check in apache that prevented PUT requests. While they were digging into the issue they found out logging was not set up properly, and because of that the error did not show up in my logs.

The PUT request was blocked by:
modsecurity_crs_30_http_policy.conf

@claudiosanches
Copy link
Contributor

Cool, tomorrow I'll add a note about it in our docs. Thanks.

@claudiosanches
Copy link
Contributor

Note added: http://woothemes.github.io/woocommerce-rest-api-docs/#troubleshooting

@hram908
Copy link

hram908 commented Sep 12, 2017

Note: 404

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: author feedback The issue/PR needs a response from any of the parties involved in the issue.
Projects
None yet
Development

No branches or pull requests

5 participants