How to update custom category attribute via REST API V1/categories/:id Magento?

If you ever created a category custom attribute for your own business requirement and want to update its value using REST API, then the given article is best suitable for you.

Let’s Assume you have created a Custom Category attribute with boolean type in the Magento admin panel.

Custom Category Attribute code: is_featured

Now We want to update its value with REST API V1/categories/:categoryId

To use Magento Category REST API, you need an admin token to do further processes with REST.

First  You have to call Admin API (rest/V1/integration/admin/token) to fetch the admin token of the store. If you have an admin token available you can start to call a category REST API.

How to make an API request to update a category custom attribute?

Action: PUT

Request URL: <WEBSITE_URL>/rest/<store_code>/V1/categories/:categoryId

To Update the custom category attribute value to all the websites of the system, use “all” in the URL otherwise add specific store code to update for the website level.

Example URL to update the value for all the websites: https://magento.test/rest/all/V1/categories/15

Example URL to update attribute value for the specified website, https://magento.test/rest/default/V1/categories/15

Header: Authorization:Bearer <ADMIN_TOKEN>

Payload Body:

    "category": {
        "custom_attributes": [
                "attribute_code": "is_featured",
                "value": "1"

Response: Updated CATEGORY ARRAY

In the above API, you have to be careful with the URL value based on the requirement.

If you want to update for all the websites, pass all to the URL otherwise it will be updated based on the store value.