Categories
Categories are used to group products and services.
| Products' and services' categories can’t intersect. They use separate endpoints. |
| Categories are hierarchical. Category can have a parent category. That tree structure supports up to 3 levels. |
List categories
$ curl -H "Authorization: Bearer api-key" https://api.planadoapp.com/v2/catalog/services/categories | jq
{
"categories": [
{
"uuid": "68fb7a80-43e6-4658-83f4-be8ac7cc70d2",
"name": "Deliveries",
"description": null,
"external_id": "deliveries",
"parent_uuid": "40ec893e-c928-41cb-8ce9-8c0ab0627f7c",
"archived": false
},
{
"uuid": "ee507ae1-5d12-4511-a123-327a4ba0c70f",
"name": "Installations",
"description": "Outdoors",
"external_id": null,
"parent_uuid": null,
"archived": false
},
...
]
}
| Field | Type | JSON type | Can be null |
Description |
|---|---|---|---|---|
|
UUID |
String |
No |
Unique identifier |
|
String |
String |
No |
Category name |
|
String |
String |
Yes |
Category description |
|
String |
String |
Yes |
|
|
UUID |
String |
Yes |
Parent category UUID |
|
Boolean |
Boolean |
No |
Whether the category is archived or not |
Create category
To create a category, send a POST request.
$ curl -H "Authorization: Bearer api-key" \
https://api.planadoapp.com/v2/catalog/products/categories \
--data @- <<EOF | jq
{
"name": "Cables",
"parent": {
"name": "Materials"
}
}
EOF
{
"category_uuid": "abbfae98-705a-4b75-af2e-9435a21b39b1"
}
In response, the API returns the uuid value of the newly created category.
Get category
Category can be retrieved by uuid or external_id.
uuid$ curl -H "Authorization: Bearer api-key" \
https://api.planadoapp.com/v2/catalog/services/categories/68fb7a80-43e6-4658-83f4-be8ac7cc70d2 | jq
{
"category": {
"uuid": "68fb7a80-43e6-4658-83f4-be8ac7cc70d2",
"name": "Deliveries",
"description": null,
"external_id": "deliveries",
"parent_uuid": "40ec893e-c928-41cb-8ce9-8c0ab0627f7c",
"archived": false
}
}
external_id$ curl -H "Authorization: Bearer api-key" https://api.planadoapp.com/v2/catalog/services/categories/deliveries | jq
{
"category": {
"uuid": "68fb7a80-43e6-4658-83f4-be8ac7cc70d2",
"name": "Deliveries",
"description": null,
"external_id": "deliveries",
"parent_uuid": "40ec893e-c928-41cb-8ce9-8c0ab0627f7c",
"archived": false
}
}
Update category
To update a category send a PATCH request to https://api.planadoapp.com/v2/catalog/services/categories/:category_id. Here :category_id is the uuid or the external_id value of the category.
$ curl --data "{\"description\":\"Free\"}" \
-X PATCH \
-H "Authorization: Bearer api-key" \
https://api.planadoapp.com/v2/catalog/services/categories/0a7b6f74-9bd3-434f-8588-c677bac93d4c | jq
{
"category_uuid": "0a7b6f74-9bd3-434f-8588-c677bac93d4c"
}
Remove category
Send a DELETE request with uuid or external_id to remove a category.
uuid$ curl -H "Authorization: Bearer api-key" -X DELETE https://api.planadoapp.com/v2/catalog/products/categories/0a7b6f74-9bd3-434f-8588-c677bac93d4c | jq
{
"message": "Performed"
}
Category archivation
Categories can be archived and unarchived. Archived categories are hidden in interface. Send corresponding POST request to https://api.planadoapp.com/v2/catalog/services/categories/:category_id/archive or https://api.planadoapp.com/v2/catalog/services/categories/:category_id/unarchive (replace services with products if needed).
uuid$ curl -H "Authorization: Bearer api-key" -X POST "https://api.planadoapp.com/v2/catalog/services/categories/b8994bf9-e46a-4f4f-9747-6a9f19b5157e/archive" | jq
{
"category_uuid": "b8994bf9-e46a-4f4f-9747-6a9f19b5157e"
}