Categories

Management of Categories

Paginated response
{ "data": { "id": "wz6d39dj", "sort": "min_price:asc", "products_count": 8, "children_count": 6, "name": "Some Category", "layout": null } }
Tree response
{ "data": { "id": "wz6d39dj", "sort": "min_price:asc", "products_count": 8, "children_count": 6, "name": "Some Category", "children": { "data": [ { "id": "wthsefs877", "sort": "min_price:asc", "products_count": 24, "children_count": 0, "name": "Some Child Category" } ] } } }
php <?php $response = CandyClient::Categories()->get([ 'tree' => true, 'depth' => 1 ]); foreach ($response->getBody() as $category) { echo $category->name; }
Parameter Type Required Description

tree

Boolean

false

Whether to show categories as a tree

depth

String|Number

false

The maximum node depth to give back

limit

String|Number

false

The number of categories to return

{ "data": { "id": "wz6d39dj", "sort": "min_price:asc", "products_count": 8, "children_count": 6, "name": "Some Category" } }
php <?php $response = CandyClient::Categories()->get($id); if ($response->failed()) { abort(404); } echo $response->getBody()->name;
Parameter Type Required Description

includes

String|Array

false

The included relations, see model definition for more info

{ "data": { "id": "wz6d39dj", "sort": "min_price:asc", "products_count": 8, "children_count": 6, "name": "Some Category" } }
php <?php $response = CandyClient::Categories($id)->Put([ 'attributes' => [ 'name' => [ 'webstore' => [ 'en' => 'A Category Name' ] ] ], 'customer_groups' => [ 'data' => [ 'visible' => true, 'purchasable' => true, ], ], 'channels' => [ 'data' => [ 'published_at' => '2019-05-16', // Can be empty ], ], ]);
Parameter Type Required Description

attributes

Array

true

The attributes to save against the category

customer_groups

Array

false

The customer groups to attach to the category

channels

Array

false

The channels to attach to the category

includes

String|Array

false

The included relations, see model definition for more info

"No Response Body"
The endpoint to help organize categories in your store.
{ "success": true }
Parameter Type Required Description

node

String

true

The ID of the target category

moved-node

String

true

The ID of the category that has moved

action

String

true

The action of the movement - before, after, over

{ "data": { "id": "wz6d39dj", "sort": "min_price:asc", "products_count": 8, "children_count": 6, "name": "Some Category", "layout": null } }
Parameter Type Required Description

sort_type

String

true

How to sort products in the category e.g. min_price:asc

products

Array

true

An array of product ID's with their position

{ "data": { "id": "wz6d39dj", "sort": "min_price:asc", "products_count": 8, "children_count": 6, "name": "Some Category" } }
Parameter Type Required Description

layout_id

String

true

The layout ID to associate to the category

Parameter Type Required Description

locale

String

true

The locale for the route e.g. EN

slug

String

true

The unique slug

description

String

false

An optional description of the slug

redirect

Boolean

false

Whether this route is a redirect

Model Definitions

Category