» Category PUT API Documentation

Putting specific categories

Endpoints:   PUT /admin/categories/{id}

Purpose

The PUT /admin/categories/{id} API allows administrators to update existing product categories with modified attributes such as availability, visibility, SEO configurations, and product associations. This API helps ensure that category details remain accurate and aligned with business needs, enabling updates to category names, product relationships, access restrictions, and marketing settings. The ability to modify metadata, analytics configurations, and sorting preferences allows for a flexible approach to category management.

Path Parameters

Field
Type
Description
id
integer
The unique identifier of the categories

Query Parameters 

This endpoint does not have any query parameters.

Use Case

Administrators use PUT /admin/categories/{id} to update product categories when changes are needed due to seasonal promotions, marketing adjustments, or modifications in product offerings. This API allows businesses to refine category settings, update customer access permissions, and modify SEO attributes to improve search rankings. Additionally, updates to analytics tracking, protection settings, and availability details enable more precise control over category visibility and customer targeting.

Request Body

{
    "name": "CATEGORY_NAME",
    "sku": "CATEGORY_SKU",
    "title": "CATEGORY_TITLE",
    "heading": "CATEGORY_HEADING",
    "available": CATEGORY_AVAILABLE,
    "category_available": CATEGORY_AVAILABLE_STATUS,
    "parent_category": {
        "id": PARENT_CATEGORY_ID,
        "name": "PARENT_CATEGORY_NAME"
    },
    "product_page": {
        "id": PRODUCT_PAGE_ID
    },
    "category_layout": {
        "id": CATEGORY_LAYOUT_ID
    },
    "product_layout": {
        "id": PRODUCT_LAYOUT_ID
    },
    "availability": {
        "on_date_range": AVAILABILITY_ON_DATE_RANGE,
        "from_date": "AVAILABILITY_FROM_DATE",
        "to_date": "AVAILABILITY_TO_DATE"
    },
    "availability_details": {
        "available_for": "AVAILABLE_FOR",
        "selected_customers": [
            SELECTED_CUSTOMER_ID
        ],
        "restrict_selected_customers": RESTRICT_SELECTED_CUSTOMERS
    },
    "protection_details": {
        "code_protected": CODE_PROTECTED,
        "code_to_protect": "CODE_TO_PROTECT"
    },
    "images": {
        "url": "IMAGE_URL",
        "base_url": "IMAGE_BASE_URL",
        "thumb_url": "IMAGE_THUMB_URL",
        "background_image": IMAGE_BACKGROUND_URL
    },
    "summary": "CATEGORY_SUMMARY",
    "description": "CATEGORY_DESCRIPTION",
    "products": [
        {
            "id": PRODUCT_ID
        }
    ],
    "tax_profile": "TAX_PROFILE_ID",
    "shipping_profile": "SHIPPING_PROFILE_ID",
    "product_sorting": "PRODUCT_SORTING",
    "disable_tracking": DISABLE_TRACKING,
    "loyalty_points": LOYALTY_POINTS,
    "seo_configurations": {
        "url": "SEO_URL",
        "overwrite_seo_settings": OVERWRITE_SEO_SETTINGS,
        "seo_title": "SEO_TITLE",
        "seo_description": "SEO_DESCRIPTION",
        "search_engine_indexing": SEARCH_ENGINE_INDEXING,
        "canonical_url": {
            "enable": CANONICAL_URL_ENABLE,
            "url": [
                "CANONICAL_URL_1",
                "CANONICAL_URL_2"
            ]
        }
    },
    "additional_meta_info": {
        "enable": ADDITIONAL_META_INFO_ENABLE,
        "meta_info": [
            {
                "tag_name": "META_TAG_NAME",
                "tag_content": "META_TAG_CONTENT"
            },
            {
                "name": "META_NAME",
                "value": "META_VALUE"
            }
        ]
    },
    "analytics": {
        "default_product_listing_configurations": DEFAULT_PRODUCT_LISTING_CONFIG,
        "third_party_analytics": {
            "enable": THIRD_PARTY_ANALYTICS_ENABLE,
            "platform": "ANALYTICS_PLATFORM",
            "enable_google_analytics": ENABLE_GOOGLE_ANALYTICS,
            "google_analysis": "GOOGLE_ANALYSIS",
            "google_ads_conversion_id": "GOOGLE_ADS_CONVERSION_ID",
            "google_ads_conversion_label": "GOOGLE_ADS_CONVERSION_LABEL",
            "debug_mode": DEBUG_MODE,
            "facebook_pixel_id": "FACEBOOK_PIXEL_ID",
            "track_event": {
                "enable": TRACK_EVENT_ENABLE,
                "events": {
                    "add_to_cart": ADD_TO_CART,
                    "view_item": VIEW_ITEM,
                    "view_item_list": VIEW_ITEM_LIST,
                    "begin_checkout": BEGIN_CHECKOUT,
                    "purchase": PURCHASE,
                    "remove_from_cart": REMOVE_FROM_CART,
                    "view_cart": VIEW_CART,
                    "add_payment_info": ADD_PAYMENT_INFO,
                    "add_shipping_info": ADD_SHIPPING_INFO,
                    "add_to_wish_list": ADD_TO_WISH_LIST
                }
            }
        },
        "seo_custom_code": {
            "enable": SEO_CUSTOM_CODE_ENABLE,
            "custom_code_in_header": "CUSTOM_CODE_HEADER",
            "custom_code_in_footer": "CUSTOM_CODE_FOOTER"
        },
        "custom_fields_for_order": [
            CUSTOM_FIELD_ID_1,
            CUSTOM_FIELD_ID_2
        ]
    }
}

Response

The API returns the updated category object, confirming that modifications have been successfully applied. The response includes key attributes such as category name, SKU, availability status, parent category details, SEO metadata, and access control settings. It also reflects changes to product associations, tax and shipping profiles, and analytics configurations. The updated timestamp ensures administrators can track modifications, making it easier to manage category updates and maintain an optimized product catalog.

PUT
https://wcapi.mywebcommander.com/api/v4/admin/categories/{id}
Try It Out
{
    "category": {
        "id": CATEGORY_ID,
        "name": "CATEGORY_NAME",
        "sku": "CATEGORY_SKU",
        "title": "CATEGORY_TITLE",
        "heading": "CATEGORY_HEADING",
        "url": "CATEGORY_URL",
        "available": CATEGORY_AVAILABLE,
        "visible": CATEGORY_VISIBLE,
        "parent_category": {
            "id": PARENT_CATEGORY_ID,
            "name": "PARENT_CATEGORY_NAME",
            "is_in_trash": PARENT_CATEGORY_IS_IN_TRASH,
            "is_parent_in_trash": PARENT_CATEGORY_IS_PARENT_IN_TRASH,
            "is_disposable": PARENT_CATEGORY_IS_DISPOSABLE
        },
        "layout": {},
        "product_page": {
            "id": PRODUCT_PAGE_ID,
            "name": "PRODUCT_PAGE_NAME"
        },
        "product_layout": {
            "id": PRODUCT_LAYOUT_ID,
            "name": "PRODUCT_LAYOUT_NAME"
        },
        "available_on_date_range": AVAILABLE_ON_DATE_RANGE,
        "available_from_date": "AVAILABLE_FROM_DATE",
        "available_to_date": "AVAILABLE_TO_DATE",
        "available_for": "AVAILABLE_FOR",
        "selected_categories": [],
        "password_protected": PASSWORD_PROTECTED,
        "password": "PASSWORD",
        "image_url": IMAGE_URL,
        "background_image_url": IMAGE_BACKGROUND_URL,
        "summary": "CATEGORY_SUMMARY",
        "description": "CATEGORY_DESCRIPTION",
        "products": [
            {
                "id": PRODUCT_ID,
                "name": "PRODUCT_NAME"
            }
        ],
        "shipping_profile": {},
        "tax_profile": {},
        "disable_tracking": DISABLE_TRACKING,
        "seo_configs": [],
        "transaction_no": TRANSACTION_NO,
        "is_disposable": IS_DISPOSABLE,
        "is_in_trash": IS_IN_TRASH,
        "is_parent_in_trash": IS_PARENT_IN_TRASH,
        "created_by": {},
        "created_on": "CREATED_ON_TIMESTAMP",
        "updated_on": "UPDATED_ON_TIMESTAMP"
    }
}