Magento – Magento 2 RESTful API update category

apicategorymagento2rest

I am using Magento 2.0.11. I would like to use the RESTful API

(HTTP:// magento2URL/index.php/rest/V1/categories/(category ID)) 

to change the "Is Active" attribute of one category from True to False.

enter image description here

The JSON packet I am sending is as following:

{"category": {"id":399,"parentId": 2,"name": "PRIMADONA","isActive": false,"position": 0,"includeInMenu": false}

and I also tried:

{"category": {"id":399,"parentId": 2,"name": "PRIMADONA","is_active": false,"position": 0,"include_in_menu": false}

The magento backend responded http 200 OK but the is_active is not updated:

< HTTP/1.1 200 OK <
* Closing connection #0 {"id":399,"parent_id":2,"name":"PRIMADONA","is_active":true,"position":0,"level":2,"children":"","updated_at":"2017-08-04
08:38:………………….>

I also tried adding "all" into the RESTful URL:

(magento2URL/index.php/rest/all/V1/categories/<category ID>)

But none of the above methods are working for me.

Is there any workaround to update the "Is Active" attribute of one category?

Best Answer

Ok so i figured it out.
URL:
/rest/V1/categories/18217
payload:
{ "category": { "is_active": false } }

Good Luck

Related Topic