1

I am calling REST PUT to change a category name (one that I am testing) and the response is 200 with the correct new name. When I do a REST GET on the id to get the category back it is again the correct name.

But when I am in administration the category name has not changed.

Could it be related to cron jobs not running?

I ran them manually but still no change.

UPDATE: When testing the same process with a product it works fine. I can POST a product and update it's name with a PUT.

UPDATE2: Logged a bug with Magento.

UPDATE3: In the db the REST PUT call seems to insert a new record with the wrong store ID (1). With sample data loaded the store ID should be 0. Need to figure out how to set the store ID through REST PUT.

UPDATE4: REST PUT works but it changes the name in Default Store View level and not at root level (All Store Views). I have yet to find a way to set the store view ID to 0 in the REST PUT call (or why it defaults to 1)

  • did you get any error or exception? please check the log once and paste here so that we can try to resolve the issues. – Manish Dec 15 '16 at 6:43
  • Any idea which log I should be looking at? Again, note that the changes do persist when I call the GET service, so it makes me wonder why admin doesn't see them. – George Dec 15 '16 at 11:21
  • Nothing in the logs. Just checked. – George Dec 15 '16 at 12:15
  • Setup a new instance with latest version CE 2.1.3 and the issue persists. – George Dec 15 '16 at 17:16
0

In the end I found the answer the hard way.

Always use the store code in your url to the endpoint to ensure you are tapping the right store.

For PUT you need to place it at the end as a parameter "store_id" and for POST you need to set it as described here: http://devdocs.magento.com/guides/v2.0/rest/rest_endpoints.html

See my bug comments here: https://github.com/magento/magento2/issues/7831

UPDATE For anyone that may find it useful I wrote a complete guide here: http://undefined.gr/site/2016/12/22/magento-2-1-3-rest-api/

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.