Categories
Categories are a core part of organizing products and content in Sleekshop. On this page, we'll dive into the different category endpoints you can use to manage categories programmatically. We'll look at how to query, create, update, and delete categories.
The category model
The category model contains all the information about your categories, such as their name, parent category, and associated products and contents.
Properties
- Name
id
- Type
- integer
- Description
Unique identifier for the category.
- Name
name
- Type
- string
- Description
The name of the category.
- Name
prio
- Type
- integer
- Description
The priority of the category.
- Name
id_parent
- Type
- integer
- Description
The ID of the parent category. 0 if it's a root category.
- Name
label
- Type
- string
- Description
The label of the category.
- Name
seo
- Type
- object
- Description
SEO information for the category, including permalink, title, description, and keywords.
- Name
attributes
- Type
- object
- Description
Custom attributes for the category.
List all categories
This endpoint allows you to retrieve a list of categories with the parent defined by ID.
Required attributes
- Name
id_parent
- Type
- integer
- Description
The ID of the parent category.
- Name
language
- Type
- string
- Description
A valid language code.
Request
curl https://demo.sleekshop.net/srv/service/ \
-d licence_username='demo_NBSqhrcrhMci15Ir9UWI' \
-d licence_password='s9vmrbwT23B7bmjR4Vmz' \
-d request='get_categories' \
-d id_parent=2 \
-d language='en_EN'
Response
{
"object": "shopcategories",
"parent_category": {
"name": "Categories",
"prio": 2,
"id": 2,
"id_parent": 0,
"label": "Categories",
"seo": {
"permalink": "",
"title": "",
"description": "",
"keywords": "",
"attributes": {},
"categories": [
{
"name": "Jackets",
"prio": 1,
"id": 3,
"id_parent": 2,
"label": "Jackets",
"seo": {
"permalink": "",
"title": "",
"description": "",
"keywords": ""
},
"attributes": {
"attr1": "Test"
}
}
]
}
}
}
Get products in category
This endpoint allows you to retrieve products contained in a category defined by its ID.
Required attributes
- Name
id_category
- Type
- integer
- Description
The ID of the category.
- Name
language
- Type
- string
- Description
A valid language code.
- Name
country
- Type
- string
- Description
A valid country code.
Optional attributes
- Name
order_columns
- Type
- array
- Description
The columns to order by.
- Name
order
- Type
- string
- Description
The order of sorting (ASC or DESC).
- Name
left_limit
- Type
- integer
- Description
The left limit of your selection.
- Name
right_limit
- Type
- integer
- Description
The right limit of your selection.
- Name
needed_attributes
- Type
- array
- Description
The attributes you want to be listed.
Request
curl https://demo.sleekshop.net/srv/service/ \
-d licence_username='demo_NBSqhrcrhMci15Ir9UWI' \
-d licence_password='s9vmrbwT23B7bmjR4Vmz' \
-d request='get_products_in_category' \
-d id_category=1 \
-d language="de_DE" \
-d country="DE" \
-d order_columns='["price"]' \
-d order="DESC" \
-d left_limit=0 \
-d right_limit=1 \
-d needed_attributes='["name","price"]'
Response
{
"object": "products_in_category",
"category": {
"id": 1,
"name": "Start",
"prio": 1,
"id_parent": 0,
"label": "Start",
"seo": {
"permalink": "",
"title": "",
"description": "",
"keywords": ""
},
"attributes": {}
},
"products": {
"Schuh blau": {
"object": "product",
"id": 15,
"name": "Schuh blau",
"creation_date": "2016-03-25 14:17:46",
"class": "colorprod",
"seo": {
"permalink": "blaue-laufschuhe-robust",
"title": "Blaue Laufschuhe mit wasserdichter Oberfläche",
"description": "Blaue Laufschuhe für Männer",
"keywords": "blau,Schuhe,Laufschuhe"
},
"availability": {
"quantity": 5,
"quantity_warning": 3,
"allow_override": 0,
"active": 1
},
"metadata": {
"element_number": "",
"taxclass": {
"name": "Standard",
"calculation": "INC",
"value": 0.19
},
"length": 0,
"width": 0,
"height": 0,
"weight": 0,
"notes": ""
},
"attributes": {
"name": {
"type": "CHAR",
"id": 154,
"name": "name",
"label": "Name",
"value": "Laufschuh blau"
},
"price": {
"type": "FLOAT",
"id": 157,
"name": "price",
"label": "Preis",
"value": 95
}
},
"variations": {}
}
}
}
Get contents in category
This endpoint delivers contents contained in a category defined by its ID.
Required attributes
- Name
id_category
- Type
- integer
- Description
The ID of the category.
- Name
language
- Type
- string
- Description
A valid language code.
Optional attributes
- Name
order_columns
- Type
- array
- Description
The columns to order by.
- Name
order
- Type
- string
- Description
The order of sorting (ASC or DESC).
- Name
left_limit
- Type
- integer
- Description
The left limit of your selection.
- Name
right_limit
- Type
- integer
- Description
The right limit of your selection.
- Name
needed_attributes
- Type
- array
- Description
The attributes you want to be listed.
Request
curl https://demo.sleekshop.net/srv/service/ \
-d licence_username='demo_NBSqhrcrhMci15Ir9UWI' \
-d licence_password='s9vmrbwT23B7bmjR4Vmz' \
-d request='get_contents_in_category' \
-d id_category=1 \
-d language="de_DE" \
-d order_columns='["name"]' \
-d order="DESC" \
-d left_limit=0 \
-d right_limit=2 \
-d needed_attributes='["headline","img"]'
Response
{
"object": "contents_in_category",
"category": {
"id": 1,
"name": "Start",
"prio": 1,
"id_parent": 0,
"label": "Start",
"seo": {
"permalink": "start",
"title": "demo",
"description": "",
"keywords": ""
},
"attributes": {}
},
"contents": {
"Teaser 1": {
"object": "content",
"id": 5,
"name": "Teaser 1",
"creation_date": "2016-03-25 12:38:23",
"class": "teaser_pic",
"seo": {
"permalink": "",
"title": "",
"description": "",
"keywords": ""
},
"attributes": {
"img": {
"type": "IMG",
"id": 51,
"name": "img",
"label": "Bild",
"value": "https://demo.sleekshop.net/srv/uploads/shopobject_images/1c14058528a52ddae559cb29d7faa94a.jpg",
"width": "NAN",
"height": "NAN"
},
"headline": {
"type": "CHAR",
"id": 52,
"name": "headline",
"label": "Überschrift",
"value": ""
}
}
},
"Teaser 2": {
"object": "content",
"id": 6,
"name": "Teaser 2",
"creation_date": "2016-03-25 12:42:29",
"class": "teaser_pic",
"seo": {
"permalink": "",
"title": "",
"description": "",
"keywords": ""
},
"attributes": {
"img": {
"type": "IMG",
"id": 54,
"name": "img",
"label": "Bild",
"value": "https://demo.sleekshop.net/srv/uploads/shopobject_images/31aee733fa02a09e23c30e8af6dabd9e.jpg",
"width": "NAN",
"height": "NAN"
},
"headline": {
"type": "CHAR",
"id": 55,
"name": "headline",
"label": "Überschrift",
"value": ""
}
}
}
}
}
Get shopobjects in category
This endpoint delivers products and contents contained in a category defined by its ID.
Required attributes
- Name
id_category
- Type
- integer
- Description
The ID of the category.
- Name
language
- Type
- string
- Description
A valid language code.
- Name
country
- Type
- string
- Description
A valid country code.
Optional attributes
- Name
order_columns
- Type
- array
- Description
The columns to order by.
- Name
order
- Type
- string
- Description
The order of sorting (ASC or DESC).
- Name
left_limit
- Type
- integer
- Description
The left limit of your selection.
- Name
right_limit
- Type
- integer
- Description
The right limit of your selection.
- Name
needed_attributes
- Type
- array
- Description
The attributes you want to be listed.
Request
curl https://demo.sleekshop.net/srv/service/ \
-d licence_username='demo_NBSqhrcrhMci15Ir9UWI' \
-d licence_password='s9vmrbwT23B7bmjR4Vmz' \
-d request='get_shopobjects_in_category' \
-d id_category=1 \
-d language="de_DE" \
-d country="DE" \
-d order_columns='["price"]' \
-d order="DESC" \
-d left_limit=0 \
-d right_limit=1 \
-d needed_attributes='["name","price"]'
Response
{
"object": "shopobjects_in_category",
"category": {
"id": 1,
"name": "Start",
"prio": 1,
"id_parent": 0,
"label": "Start",
"seo": {
"permalink": "start",
"title": "demo",
"description": "",
"keywords": ""
},
"attributes": {}
},
"products": {
"Schuh blau": {
"object": "product",
"id": 15,
"name": "Schuh blau",
"creation_date": "2016-03-25 14:17:46",
"class": "colorprod",
"seo": {
"permalink": "blaue-laufschuhe-robust",
"title": "Blaue Laufschuhe mit wasserdichter Oberfläche",
"description": "Blaue Laufschuhe für Männer",
"keywords": "blau,Schuhe,Laufschuhe"
},
"availability": {
"quantity": 5,
"quantity_warning": 3,
"allow_override": 0,
"active": 1
},
"attributes": {
"name": {
"type": "CHAR",
"id": 154,
"name": "name",
"label": "Name",
"value": "Laufschuh blau"
},
"price": {
"type": "FLOAT",
"id": 157,
"name": "price",
"label": "Preis",
"value": 95
}
},
"variations": {}
}
}
}
Dump category
This endpoint delivers products and contents recursively from a root category defined by its ID.
Required attributes
- Name
id_category
- Type
- integer
- Description
The ID of the root category.
- Name
language
- Type
- string
- Description
A valid language code.
- Name
country
- Type
- string
- Description
A valid country code.
Optional attributes
- Name
order_columns
- Type
- array
- Description
The columns to order by.
- Name
order
- Type
- string
- Description
The order of sorting (ASC or DESC).
- Name
left_limit
- Type
- integer
- Description
The left limit of your selection.
- Name
right_limit
- Type
- integer
- Description
The right limit of your selection.
- Name
needed_attributes
- Type
- array
- Description
The attributes you want to be listed.
- Name
depth
- Type
- integer
- Description
Specifies the depth to iterate. Use 0 for the maximum depth.
Request
curl https://demo.sleekshop.net/srv/service/ \
-d licence_username='demo_NBSqhrcrhMci15Ir9UWI' \
-d licence_password='s9vmrbwT23B7bmjR4Vmz' \
-d request='dump_category' \
-d id_category=2 \
-d language="de_DE" \
-d country="DE" \
-d order_columns='["price"]' \
-d order="DESC" \
-d left_limit=0 \
-d right_limit=1 \
-d needed_attributes='["name","price"]' \
-d depth=0
Response
{
"object": "category_dump",
"parent_category": {
"name": "Categories",
"prio": 2,
"id": 2,
"id_parent": 0,
"label": "Categories",
"seo": {
"permalink": "",
"title": "",
"description": "",
"keywords": ""
},
"attributes": {}
},
"shop_categories": {
"Jacken": {
"object": "category_dump",
"parent_category": {
"name": "Jacken",
"prio": 1,
"id": 3,
"id_parent": 2,
"label": "Jacken",
"seo": {
"permalink": "jacken",
"title": "Jacken",
"description": "Jacken",
"keywords": "jacken"
},
"attributes": {}
},
"products_in_category": {
"category": {
"id_category": 3,
"name": "Jacken"
},
"products": {
"Jacke rot M": {
"object": "product",
"id": 20,
"name": "Jacke rot M",
"creation_date": "2016-03-25 14:29:14",
"class": "sizeprod",
"seo": {
"permalink": "warme-herren-winterjacke",
"title": "Superwarme und flauschige Winterjacke für Männer",
"description": "Winterjacke für jedes Wetter!",
"keywords": "warm,winter,maenner,jacke"
},
"availability": {
"quantity": 0,
"quantity_warning": 0,
"allow_override": 0,
"active": 0
},
"metadata": {
"element_number": "",
"taxclass": {
"name": "Standard",
"calculation": "INC",
"value": 0.19
},
"length": 0,
"width": 0,
"height": 0,
"weight": 0,
"notes": ""
},
"attributes": {
"name": {
"type": "CHAR",
"id": 229,
"name": "name",
"label": "Name",
"value": "Winterjacke rot M"
},
"price": {
"type": "FLOAT",
"id": 232,
"name": "price",
"label": "Preis",
"value": 89
}
},
"variations": {}
}
}
}
}
}
}
SEO Get products in category
This endpoint delivers products contained in a category defined by its permalink.
Required attributes
- Name
permalink
- Type
- string
- Description
A valid permalink of the category.
- Name
country
- Type
- string
- Description
A valid country code.
Optional attributes
- Name
order_columns
- Type
- array
- Description
The columns to order by.
- Name
order
- Type
- string
- Description
The order of sorting (ASC or DESC).
- Name
left_limit
- Type
- integer
- Description
The left limit of your selection.
- Name
right_limit
- Type
- integer
- Description
The right limit of your selection.
- Name
needed_attributes
- Type
- array
- Description
The attributes you want to be listed.
Request
curl https://demo.sleekshop.net/srv/service/ \
-d licence_username='demo_NBSqhrcrhMci15Ir9UWI' \
-d licence_password='s9vmrbwT23B7bmjR4Vmz' \
-d request='seo_get_products_in_category' \
-d permalink='jacken' \
-d country="DE" \
-d order_columns='["price"]' \
-d order="DESC" \
-d left_limit=0 \
-d right_limit=1 \
-d needed_attributes='["name","price"]'
Response
{
"object": "products_in_category",
"category": {
"id": 3,
"name": "Jacken",
"prio": 1,
"id_parent": 2,
"label": "Jacken",
"seo": {
"permalink": "jacken",
"title": "Jacken",
"description": "Jacken",
"keywords": "jacken"
},
"attributes": {}
},
"products": {
"Jacke rot M": {
"object": "product",
"id": 20,
"name": "Jacke rot M",
"creation_date": "2016-03-25 14:29:14",
"class": "sizeprod",
"seo": {
"permalink": "warme-herren-winterjacke",
"title": "Superwarme und flauschige Winterjacke für Männer",
"description": "Winterjacke für jedes Wetter!",
"keywords": "warm,winter,maenner,jacke"
},
"availability": {
"quantity": 0,
"quantity_warning": 0,
"allow_override": 0,
"active": 0
},
"attributes": {
"name": {
"type": "CHAR",
"id": 229,
"name": "name",
"label": "Name",
"value": "Winterjacke rot M"
},
"price": {
"type": "FLOAT",
"id": 232,
"name": "price",
"label": "Preis",
"value": 89
}
},
"variations": {}
}
}
}
SEO Get contents in category
This endpoint delivers contents contained in a category defined by its permalink.
Required attributes
- Name
permalink
- Type
- string
- Description
A valid permalink of the category.
Optional attributes
- Name
order_columns
- Type
- array
- Description
The columns to order by.
- Name
order
- Type
- string
- Description
The order of sorting (ASC or DESC).
- Name
left_limit
- Type
- integer
- Description
The left limit of your selection.
- Name
right_limit
- Type
- integer
- Description
The right limit of your selection.
- Name
needed_attributes
- Type
- array
- Description
The attributes you want to be listed.
Request
curl https://demo.sleekshop.net/srv/service/ \
-d licence_username='demo_NBSqhrcrhMci15Ir9UWI' \
-d licence_password='s9vmrbwT23B7bmjR4Vmz' \
-d request='seo_get_contents_in_category' \
-d permalink='start' \
-d order_columns='["price"]' \
-d order="DESC" \
-d left_limit=0 \
-d right_limit=1 \
-d needed_attributes='["name","price"]'
Response
{
"object": "contents_in_category",
"category": {
"id": 1,
"name": "Start",
"prio": 1,
"id_parent": 0,
"label": "Start",
"seo": {
"permalink": "start",
"title": "demo",
"description": "",
"keywords": ""
},
"attributes": {}
},
"contents": {
"Teaser 1": {
"object": "content",
"id": 5,
"name": "Teaser 1",
"creation_date": "2016-03-25 12:38:23",
"class": "teaser_pic",
"seo": {
"permalink": "",
"title": "",
"description": "",
"keywords": ""
},
"attributes": {
"img": {
"type": "IMG",
"id": 51,
"name": "img",
"label": "Bild",
"value": "https://demo.sleekshop.net/srv/uploads/shopobject_images/1c14058528a52ddae559cb29d7faa94a.jpg",
"width": "NAN",
"height": "NAN"
},
"headline": {
"type": "CHAR",
"id": 52,
"name": "headline",
"label": "Überschrift",
"value": ""
}
}
}
}
}
SEO Get shopobjects in category
This endpoint delivers products and contents contained in a category defined by its permalink.
Required attributes
- Name
permalink
- Type
- string
- Description
A valid permalink of the category.
- Name
country
- Type
- string
- Description
A valid country code.
Optional attributes
- Name
order_columns
- Type
- array
- Description
The columns to order by.
- Name
order
- Type
- string
- Description
The order of sorting (ASC or DESC).
- Name
left_limit
- Type
- integer
- Description
The left limit of your selection.
- Name
right_limit
- Type
- integer
- Description
The right limit of your selection.
- Name
needed_attributes
- Type
- array
- Description
The attributes you want to be listed.
Request
curl https://demo.sleekshop.net/srv/service/ \
-d licence_username='demo_NBSqhrcrhMci15Ir9UWI' \
-d licence_password='s9vmrbwT23B7bmjR4Vmz' \
-d request='seo_get_shopobjects_in_category' \
-d permalink='start' \
-d country="DE" \
-d order_columns='["price"]' \
-d order="DESC" \
-d left_limit=0 \
-d right_limit=1 \
-d needed_attributes='["name","price"]'
Response
{
"object": "shopobjects_in_category",
"category": {
"id": 1,
"name": "Start",
"prio": 1,
"id_parent": 0,
"label": "Start",
"seo": {
"permalink": "start",
"title": "demo",
"description": "",
"keywords": ""
},
"attributes": {}
},
"products": {
"Schuh blau": {
"object": "product",
"id": 15,
"name": "Schuh blau",
"creation_date": "2016-03-25 14:17:46",
"class": "colorprod",
"seo": {
"permalink": "blaue-laufschuhe-robust",
"title": "Blaue Laufschuhe mit wasserdichter Oberfläche",
"description": "Blaue Laufschuhe für Männer",
"keywords": "blau,Schuhe,Laufschuhe"
},
"availability": {
"quantity": 5,
"quantity_warning": 3,
"allow_override": 0,
"active": 1
},
"attributes": {
"name": {
"type": "CHAR",
"id": 154,
"name": "name",
"label": "Name",
"value": "Laufschuh blau"
},
"price": {
"type": "FLOAT",
"id": 157,
"name": "price",
"label": "Preis",
"value": 95
}
},
"variations": {}
}
}
}
Create a category
This endpoint allows you to create a new category in Sleekshop.
Required attributes
- Name
id_parent
- Type
- integer
- Description
The ID of the parent category. Use 0 for root categories.
- Name
name
- Type
- string
- Description
The name of the new category.
Optional attributes
- Name
labels
- Type
- object
- Description
Labels for the category in different languages.
- Name
attributes
- Type
- object
- Description
Custom attributes for the category.
- Name
seo
- Type
- object
- Description
SEO information for the category.
Request
curl https://demo.sleekshop.net/srv/service/ \
-d licence_username='demo_NBSqhrcrhMci15Ir9UWI' \
-d licence_password='s9vmrbwT23B7bmjR4Vmz' \
-d licence_secret_key='your_secret_key' \
-d request='create_category' \
-d id_parent=123 \
-d name='name_new' \
-d labels='{"de_DE":"123321"}' \
-d attributes='{"de_DE":{"name":"Test"}}' \
-d seo='{"de_DE":{"permalink":"test546576"}}'
Response
{
"object": "create_category",
"id": "162"
}
Update a category
This endpoint allows you to update an existing category in Sleekshop.
Required attributes
- Name
id_category
- Type
- integer
- Description
The ID of the category to update.
Optional attributes
- Name
name
- Type
- string
- Description
The new name for the category.
- Name
labels
- Type
- object
- Description
Updated labels for the category.
- Name
attributes
- Type
- object
- Description
Updated custom attributes for the category.
- Name
seo
- Type
- object
- Description
Updated SEO information for the category.
Request
curl https://demo.sleekshop.net/srv/service/ \
-d licence_username='demo_NBSqhrcrhMci15Ir9UWI' \
-d licence_password='s9vmrbwT23B7bmjR4Vmz' \
-d licence_secret_key='your_secret_key' \
-d request='update_category' \
-d id_category=123 \
-d name='name_new' \
-d labels='{"de_DE":"123321"}' \
-d attributes='{"de_DE":{"name":"Test"}}' \
-d seo='{"de_DE":{"permalink":"test546576"}}'
Response
{
"object": "update_category",
"status": "success"
}
Delete a category
This endpoint allows you to delete a category from your Sleekshop instance. Note: This will also remove all associations this category has with products and content.
Required attributes
- Name
id_category
- Type
- integer
- Description
The ID of the category to delete.
Request
curl https://demo.sleekshop.net/srv/service/ \
-d licence_username='demo_NBSqhrcrhMci15Ir9UWI' \
-d licence_password='s9vmrbwT23B7bmjR4Vmz' \
-d licence_secret_key='your_secret_key' \
-d request='delete_category' \
-d id_category=123
Response
{
"object": "delete_category",
"status": "success"
}