category.info

This method is used to obtain information about a Category

Version

v2

Arguments

This method has the path /catalog/<version>/category.info and follows the MicroBase API calling conventions.

Argument Required Type Example Description
id yes String SJlkcsaQ The Category id to get info on.
withChildren no Boolean true Set to 'true' to obtain the children categories. Defaults to 'false'.
recursive no Boolean true Set to 'true' to recursively get the children children's. Defaults to 'false'.
locale no String en Filter the i18n Strings and return only that locale.

Response

Returns a Category object:

{
    "ok": true,
    "category": {
        "id": "SJlkcsaQ",
        "level": 2,
        "title": {
          "en": "Category with classifications",
          "es": "Categoria con classificaciones"
         },
        "description": {
          "en": "This is the Category with classifications",
          "es": "Esta es la Categoría con clasificaciones"
        },
        "slug": "categorywithclass01",
        "parent": "ROOT",
        "classifications": [
            {"id": "size", "description": "Size", "type": "NUMBER", "mandatory": true},
            {"id": "tech", "description": "Technology", "type": "STRING", "mandatory": true}
        ]
    }
}

If a locale was specified, the i18n strings are filtered in the response. For a locale=en the title field will look like:

{
  "ok": true,
  "category": {
    "id": "SJlkcsaQ",
    "level": 2,
    "title": "Category with classifications",
    "description": "This is the Category with classifications",
    "slug": "categorywithclass01",
    "parent": "ROOT",
    "classifications": [
      {"id": "size", "description": "Size", "type": "NUMBER", "mandatory": true},
      {"id": "tech", "description": "Technology", "type": "STRING", "mandatory": true}
    ]
  }
}

Errors

Expected errors that this method could return. Some errors return additional data.

Error Data Description
category_not_found The id not found The Category was not found

Example

curl --request GET \
  --url http://localhost:3000/services/catalog/v1/category.info?id=SJlkcsaQ \
  --header 'authorization: Bearer xxxxx...' \
  --header 'accept: application/json' \
  --header 'content-type: application/json'