Permalink
Fetching contributors…
Cannot retrieve contributors at this time
98 lines (62 sloc) 2.12 KB
---
parent: apiv3
title: category
---
# Category <%= edit_link %>
Categories are organized in a tree-like structure.
An [SKU](/api/v3/sku/) always belongs to a leaf (ending) category.
Leaf categories have `children_count` equal to <mark>0</mark>.
<%= partial 'partials/toc' %>
## List all categories
<pre class="terminal">
GET /categories
</pre>
<%= render_recording :categories_index %>
## Retrieve a single category
<pre class="terminal">
GET /categories/:id
</pre>
<%= render_recording :categories_show %>
## Retrieve the parent of a category
<pre class="terminal">
GET /categories/:id/parent
</pre>
<%= render_recording :category_parent %>
## Retrieve the root category
<pre class="terminal">
GET /categories/root
</pre>
<%= render_recording :categories_root %>
## List the children categories of a category
<pre class="terminal">
GET /categories/:id/children
</pre>
<%= render_recording :children_api_category %>
## List a category's specifications
<pre class="terminal">
GET /categories/:id/specifications
</pre>
<%= render_recording :category_specifications %>
The specification group can be included / embedded using the `group` value.
Groups represent a logical grouping of specifications.
<pre class="terminal">
GET /categories/:id/specifications?include=group
</pre>
<%= render_recording :category_specifications_with_group %>
## List a category's manufacturers
<pre class="terminal">
GET /categories/:id/manufacturers
</pre>
<%= render_recording :category_manufacturers %>
### Ordering
Name | Type | Value | Description
----------- | ------ | -------------------------------------------------------- | ------------
`order_by` | String | `name`, `popularity` <small class="mark">default</small> | Order by name or popularity
`order_dir` | String | `asc`, `desc` <small class="mark">default</small> | Order ascending or descending
## List a category's favorites
> ##### Note
> Requires user token with the 'favorites' permission.
<pre class="terminal">
GET /categories/:id/favorites
</pre>
<%= render_recording :category_favorites %>