V1 and V2Categories

Search product categories

POST
/api/v1/categories/product/search

Filter on available product categories by multiple criteria

Filter structure and format is described under Resources section in this guide

Current version of the API supports the following set of fields

FieldDescription
idCategory id is always returned by default
nameCategory friendly name
pathCategory full path
parents_idsArray of ordered parent categories
n_childrenNumber of subcategories in the current category
orderPosition of current category in parent category

Restrictions

  • Search requests
    • Search filters MUST include all necessary columns (except ID which is returned by default). If an attribute is not explicitly requested it won’t be returned by the API. Available attributes can be obtained by means of the available https://pim.plytix.com/api/v1/filters/ endpoint. “key” value is what MUST be used in requests. Requesting non-existing attributes will return a 422 error code You are allowed to sort by columns not included in “attributes” field, however this attribute won’t be returned

    • Search filters will return a 422 error code if any of the following conditions is met: a) Field does not exist b) Operator is not allowed for the given field (available operators and fields can be obtained using /filters/{item} endpoint) c) Value has no meaning for the given operator. The arity of available operators can be found in API documentation

    • Pagination: the number of items that can be requested (pagination.page_size) is limited to a maximum 100 items. A 422 code will be returned from API if this limit is exceeded. If paginations is omitted 25 items of the first page will be returned.

Authorization

bearerAuth
AuthorizationBearer <token>

Obtain a token via POST /auth/api/get-token (15 minute lifetime), then send it as Authorization: Bearer <token>.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST 'https://example.com/api/v1/categories/product/search' \  -H 'Content-Type: application/json' \  --data-raw '{  "attributes": [    "name",    "n_children"  ],  "filters": [    [      {        "field": "parent_id",        "operator": "!exists"      }    ]  ],  "pagination": {    "page_size": 25,    "page": 1,    "order": "order"  }}'
{  "data": [    {      "id": "5cf4d55eb694740001006ed1",      "n_children": 1,      "name": "Kitchen Sinks"    },    {      "id": "5cf4d561b694740001006ed2",      "n_children": 3,      "name": "Kitchen Faucets"    },    {      "id": "5cf69f4d568c1c001c039c76",      "n_children": 2,      "name": "Bathroom Faucets"    }  ],  "pagination": {    "count": 3,    "order": "order",    "page": 1,    "page_size": 25,    "total_count": 11  }}