Catalog.getCategories
Request the Catalog Category data from the shop system.
Request
JSON Example
[
{
"api":1,
"method":"auth",
"params":{
"username":"...",
"password":"..."
},
"id":1
},
{
"api": 1,
"method": "Catalog.getCategories",
"params": {},
"id": 1
}
]
Response
Response sends all Category records:
[
{
"api":1,
"result":[
{
"categoryId": 1,
"globalIdentifier": 'c1',
"status": "active",
"left": 1,
"right": 1557,
"name": "Root Category",
"name_en": "Root Category"
},
{
"categoryId": 28,
"globalIdentifier": 'c123',
"status": "active",
"left": 28,
"right": 57,
"name": "Chaussures",
"name_en": "Shoes"
},
{
"categoryId": 32,
"globalIdentifier": 'c124',
"status": "inactive",
"left": 58,
"right": 63,
"name": "Chemises",
"name_en": "Shirts"
}
],
"id":1
}
]
Make sure values are properly encoded in the types specified below, as the Sync Agent client will not do any automatic conversion. Using strings instead of integers (eg.: "42"
instead of 42
), or integers instead of booleans (1
instead of true
) will result in a validation error during sync.
Field name |
Type |
Mandatory |
Value |
Description |
---|---|---|---|---|
categoryId |
integer |
yes |
undefined | id of the category in the Shop system |
globalIdentifier |
varchar(255) |
no |
undefined | identifier for this category, which is unique across several country databases for your shop system 1) |
status |
enum |
yes |
"active", "inactive", "inherited_inactive", "deleted" |
undefined |
left |
integer |
yes |
undefined | left value of this category inside the nested set model |
right |
integer |
yes |
undefined | right value of this category inside the nested set model |
name |
varchar(255) |
yes |
undefined | Name of the category in the local language of the shop (e. g. Thai, French) |
name_en |
varchar(255) |
no |
undefined | Category name in English |
1) not used by all shop systems
Nested set model
The fields "left" and "right" represent the values of the category from the nested set model of the whole category tree.
For more details see: http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/