ZRPL
  • Welcome!
  • Quick Start
  • Reference
    • API Reference
      • Categories List
      • Category Details by ID
      • Create Simple Product
      • Config Product Creation
      • Product List
      • Update Existing Product
      • Product Details by SKU
      • Product Details by ID
      • Products in Category
      • Create Order
      • Order Details
      • Order History
      • Create Customer
      • Customer Token
      • Create Customer Cart
      • Add Item to Cart
      • View Cart
      • Update Cart
      • Delete Cart
      • Country Code
      • Set Shipping and Billing
      • Place Order
      • Customer Details
Powered by GitBook
On this page
  1. Reference
  2. API Reference

Category Details by ID

This API provides the specific Category Details based on ID.

GET {{Base_url}}/rest/V1/categories

This endpoint retrieves detailed information for a specific category by its ID. The response includes metadata such as name, parent ID, active status, position, creation date, custom attributes, and hierarchical details. It’s ideal for obtaining and managing specific category information.

curl --location '{{Base_url}}/rest/V1/categories/73' \
--header 'Authorization: Bearer eyJraWQiOiIxIiwiYWxnIjoiSFMyNTYifQ.eyJ1aWQiOjU1LCJ1dHlwaWQiOjIsImlhdCI6MTczNTI5NzMxOCwiZXhwIjoxNzM1MzAwOTE4fQ.6yN-uGjVd1SEbzrLmp8OJywW7ECTUPTpdtqpzcD8qlo' \
--header 'Cookie: PHPSESSID=06uefebf3h3ncaqq0vbiodklgu'

Response Codes:

  • 200 OK: Category details retrieved successfully.

  • 401 Unauthorized: Invalid or missing authentication token.

  • 404 Not Found: Category with the specified ID does not exist.

Responses

{
    "id": 73,
    "parent_id": 2,
    "name": "Electronics",
    "is_active": true,
    "position": 2,
    "level": 2,
    "children": "15,21,44,69,78,87,88,92,162,281,723,811",
    "created_at": "2021-09-15 06:23:21",
    "updated_at": "2024-12-06 07:28:44",
    "path": "1/2/73",
    "available_sort_by": [
        "name",
        "price"
    ],
    "include_in_menu": true,
    "custom_attributes": [
        {
            "attribute_code": "image",
            "value": "/media/catalog/category/Gift_Cards_1440_360_px__1_3_11.png"
        },
        {
            "attribute_code": "display_mode",
            "value": "PRODUCTS"
        },
        {
            "attribute_code": "is_anchor",
            "value": "1"
        },
        {
            "attribute_code": "path",
            "value": "1/2/73"
        },
        {
            "attribute_code": "children_count",
            "value": "153"
        },
        {
            "attribute_code": "default_sort_by",
            "value": "price"
        },
        {
            "attribute_code": "custom_use_parent_settings",
            "value": "0"
        },
        {
            "attribute_code": "custom_apply_to_products",
            "value": "0"
        },
        {
            "attribute_code": "url_key",
            "value": "electronics"
        },
        {
            "attribute_code": "url_path",
            "value": "electronics"
        },
        {
            "attribute_code": "sw_menu_hide_item",
            "value": "0"
        },
        {
            "attribute_code": "sw_menu_block_left_width",
            "value": "0"
        },
        {
            "attribute_code": "sw_menu_block_right_width",
            "value": "0"
        },
        {
            "attribute_code": "sw_ocat_hide_this_item",
            "value": "0"
        },
        {
            "attribute_code": "ks_include_in_marketplace",
            "value": "0"
        }
    ]
}

Top-Level Attributes

  1. id

    • Definition: A unique identifier for the category.

    • Example: "id": 73

      • The category Electronics is uniquely identified by the ID 73.

  2. parent_id

    • Definition: The ID of the parent category to which this category belongs.

    • Example: "parent_id": 2

      • The parent category of Electronics is identified by the ID 2.

  3. name

    • Definition: The display name of the category.

    • Example: "name": "Electronics"

      • The category is named Electronics.

  4. is_active

    • Definition: Indicates whether the category is active (true) or inactive (false).

    • Example: "is_active": true

      • The Electronics category is active and will appear in the application.

  5. position

    • Definition: Specifies the position of the category among its siblings under the same parent.

    • Example: "position": 2

      • Electronics appears second under its parent category.

  6. level

    • Definition: The hierarchy level of the category in the catalog.

    • Example: "level": 2

      • Electronics is a second-level category.

  7. children

    • Definition: A comma-separated list of IDs for all immediate child categories.

    • Example: "children": "15,21,44,69,78,87,88,92,162,281,723,811"

      • The Electronics category has child categories with IDs 15, 21, 44, etc..

  8. created_at

    • Definition: The date and time when the category was created.

    • Example: "created_at": "2021-09-15 06:23:21"

      • The Electronics category was created on September 15, 2021, at 6:23 AM UTC.

  9. updated_at

    • Definition: The date and time when the category was last updated.

    • Example: "updated_at": "2024-12-06 07:28:44"

      • The Electronics category was last updated on December 6, 2024, at 7:28 AM UTC.

  10. path

    • Definition: A hierarchical representation of the category path, listing all parent category IDs.

    • Example: "path": "1/2/73"

      • The Electronics category is a child of ID 2, which is itself a child of ID 1.

  11. available_sort_by

    • Definition: Lists the sorting options available for products in this category.

    • Example: "available_sort_by": ["name", "price"]

      • Products in the Electronics category can be sorted by name or price.

  12. include_in_menu

    • Definition: Indicates whether the category should be displayed in the navigation menu.

    • Example: "include_in_menu": true

      • The Electronics category will be included in the menu.


custom_attributes

The custom_attributes array contains additional details about the category, specified as key-value pairs.

  1. image

    • Definition: The path to the image representing this category.

    • The image for the Electronics category is located at /media/catalog/category/Gift_Cards_1440_360_px__1_3_11.png.

  2. display_mode

    • Definition: Specifies how the category is displayed (e.g., "PRODUCTS").

    • The Electronics category displays products.

  3. is_anchor

    • Definition: Indicates whether the category acts as an anchor for filtering.

    • The Electronics category is an anchor category (value 1 means true).

  4. path

    • Definition: Same as the top-level path attribute.

    • Example: "value": "1/2/73"

  5. children_count

    • Definition: Total count of all child categories under this category.

    • The Electronics category has 153 total child categories.

  6. default_sort_by

    • Definition: The default sorting option for products in this category.

    • Products in Electronics are sorted by price by default.

  7. custom_use_parent_settings

    • Definition: Indicates whether this category inherits settings from its parent.

    • The Electronics category does not inherit parent settings (value 0).

  8. custom_apply_to_products

    • Definition: Indicates if custom settings apply to products in this category.

    • Custom settings do not apply to products in this category.

  9. url_key

    • Definition: The unique key for constructing the category URL.

    • The URL key for the Electronics category is electronics.

  10. url_path

    • Definition: The full path used in the category URL.

    • Example: "value": "electronics"

  11. sw_menu_hide_item

    • Definition: Indicates whether this category is hidden in the menu.

    • The Electronics category is not hidden in the menu (value 0).

  12. ks_include_in_marketplace

    • Definition: Indicates if the category is included in the marketplace.

    • The Electronics category is not included in the marketplace.


{
    "message": "The consumer isn't authorized to access %resources.",
    "parameters": {
        "resources": "Magento_Catalog::categories"
    }
}
{
    "message": "No such entity with %fieldName = %fieldValue",
    "parameters": {
        "fieldName": "id",
        "fieldValue": 101
    }
}
PreviousCategories ListNextCreate Simple Product

Last updated 4 months ago