abinop
July 2, 2019, 12:00am
1
Hello,
I try to update a product via REST API using the url http://example.com/api/ products/:id as mentioned here .
I am using the PUT method but I am getting
405 Method Not Allowed
The requested method PUT is not allowed for the URL /api/stores/1/products/27
I am trying from Postman, and creating or getting products works fine. What could go wrong?
Hello
http://your_host/api/products/product_id e.g
http://csul/4101a/api/products/17
You can set Basic Autorization admin_login_email:API_KEY
You can set PUT method
Body set on "raw" and set JSON (application/json)
And in body add e.g.
{"product": "test"} or {"amount": "1000"} or other
and click "Send"
See screenshot
Best regards
Robert
postman.png
abinop
July 3, 2019, 12:00am
3
Hello, thank you for your answer.
The problem is that I am doing exactly that. In other cases (post, get) I have no such problems....
You can see it in the following screenshots
[attachment=13884:Screenshot 2019-07-03 at 08.05.52.jpg]
[attachment=13885:Screenshot 2019-07-03 at 08.08.png]
Screenshot 2019-07-03 at 08.05.52.jpg
Screenshot 2019-07-03 at 08.08.png
Please make sure that the Manage catalog permission is not disabled for the used account
abinop
July 3, 2019, 12:00am
5
Where is this setting Robert? I cannot find it.
abinop
July 3, 2019, 12:00am
6
Under "Customers-> User groups" the admin (where this user belongs to) as access to everything.
But after all why only this PUT command fails? Every other command works
Hello
Please try remove from url "stores/1" and try again
Best regards
Robert
abinop
July 3, 2019, 12:00am
8
I am afraid I tried this and the problem remains the same :(
[attachment=13886:Screenshot 2019-07-03 at 11.23.06.jpg]
Screenshot 2019-07-03 at 11.23.06.jpg
Hello
Can you put a devel version of your store so that you can do tests on it ?
I understand that you have set api authorization correctly?
Best regards
Robert
abinop
July 3, 2019, 12:00am
10
Yes I have a develop version online. Do you want me to send you in a private message access to take a look?
abinop
July 4, 2019, 12:00am
12
The problem was that Apache did not support PUT and DELETE. As soon as we enabled them everything worked as expected.
Hi!
One of the easiest ways to update products on CS-Cart is to use API 2 Cart solution.
For example, it provides the product.update API method that enables to update price and quantity for a specific product on CS-Cart.
macc82
July 2, 2021, 12:00am
14
Hi, I have been doing some tests also to update products with the REST API and with the configuration you indicated I did not get any error, but the data was not updated either. I added to the headers of the request "Content-Type: application/json" and indicate in the body {"amount": 5} and now it did update.
I did these tests from Postman, has anyone been able to use the API with Javascript in Edge/Chrome? If so, can you tell me how?
Is it possible to easily add a second heading to an invoice? There are invoices, credit memos, and orders, for example. I'd want to introduce a new kind. Have it selectable in order status, like a buy order or something. I've generated the language variable, but I'm not sure where else in the template I need to make changes.