category.list

This method is used to list the Categories, filering the results and selecting the fields returned.

Version

v2

Arguments

This method has the path `/catalog//category.list and follows the MicroBase API calling conventions.

Argument Required Type Example Description
id no String List SJlkcsaQ, WER1YST2 Comma separated Categories ids list.
title no i18nString refrigerator Title /${title}/i regex expression. Must also specify the locale.
description no i18nString side by side Description /${title}/i regex expression. Must also specify the locale.
slug no String List side-by-side-refrigerator Comma separated slugs list.
parent no String List ROOT Comma separated parent ids.
path no String ROOT.SJlkcsaQ Start with path /^${path}/i regex expression.
fields no String List title,path Comma separated field list to return.
limit no Number 5 Maximum number of documents to return. Defaults to 10
skip no Number 10 Skips over the first specified number of documents. Defaults to 0.
locale no (*) String en Filter the i18n Strings and return only that locale. Mandatory if a i18nStringis used in the query.

Response

Returns a page:

{
  "ok": true,
  "page": {
    "limit": 10,
    "skip": 0
  },
  "data": [
    {
      "path": "ROOT.SkeZVQsV.BJ4SBQsE.HyS4SSXoE",
      "parent": "BJ4SBQsE",
      "title": { 
        "en": "Side by Side Refrigerator"
      },
      "description": { 
        "en": "Side by side"
      },
      "slug": "side-by-side-refrigerator",
      "classifications": [],
      "level": 4,
      "id": "HyS4SSXoE"
    }
  ]
}

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,
  "page": {
    "limit": 10,
    "skip": 0
  },
  "data": [
    {
      "path": "ROOT.SkeZVQsV.BJ4SBQsE.HyS4SSXoE",
      "parent": "BJ4SBQsE",
      "title": "Side by Side Refrigerator",
      "description": "Side by side",
      "slug": "side-by-side-refrigerator",
      "classifications": [],
      "level": 4,
      "id": "HyS4SSXoE"
    }
  ]
}

If you use a i18nString as part of the query, you must also specify the locale.

Errors

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

Error Data Description
no_locale_provided field Must specify a locale for this field.

Example

curl --request GET \
  --url 'http://localhost:3000/services/catalog/v1/category.list?title=frigo&fields=sku,title,path' \
  --header 'authorization: Bearer xxxxx...' \
  --header 'accept: application/json' \
  --header 'content-type: application/json'