Runtime_CategoryList_Load_Query
#
This function loads a list of categories and sub-categories for a store. An optional “children” filter is available to request how many levels of sub-categories you want returned.
Request Parameters#
Parameter |
Type | Description |
---|---|---|
session_type |
String | This will always have a hard-coded value of “runtime.” This tells Miva, no authentication is needed for the API call. |
count |
Number | Maximum lines of data allowed to be returned in the response. This limit is used to prevent excessive amounts of data return |
filter |
String | A string for filtering returned data |
offset |
Number | Used with the Count parameter for paginating results of large datasets. Default 0 is no offset. |
sort |
String | The order for sorting returned data |
Session_ID |
String | Optional Passing the Session_ID in the request will allow any customer-specific discounts get applied. |
On Demand Columns#
Parameter |
Type | Description |
---|---|---|
CustomField_Values:* "CustomField_Values:<module code>:<field code>" "CustomField_Values:<module code>:*" |
Includes all custom fields in the output Includes that specific field in the output Includes all fields for the specified module in the output |
Other Custom Filters#
Name | Description |
---|---|
children |
When specified, child categories are loaded up to the specified depth. Custom field output for child categories should be the same as the primary categories, but the search filter should not be applied. i.e. the search filter determines the highest-level returned categories, but for each of those categories, all of their children are returned. |
Response Parameters#
Parameter |
Type | Description |
---|---|---|
total_count |
Number | total_count is the total number of records that match your search criteria. Note: this is not always the total products returned. Based on the Count and Offset parameters passed, the number of records returned could be different than the total_count. |
start_offset |
Number | Number of the starting offset number of products to return. Used in conjunction with the Count parameter for paginating results of large datasets. |
id |
Number | Category ID |
parent_id |
Number | Id of the categories parent. Will be 0 if there is no parent |
name |
String | Category Name |
page_title |
String | Category Page Title |
url |
String | URL for the Category |
children |
Object | Sub-Categories/Children for the category. Only present if “children” search filter is passed in the request. |
Example Requests#
{
"Store_Code": "{{Store_Code}}",
"Miva_Request_Timestamp": "{{$timestamp}}",
"Function": "Runtime_CategoryList_Load_Query",
"Session_Type": "runtime",
"Count": 0,
"Offset": 0,
"Filter": [
{
"name": "children",
"value": {
"depth": "3"
}
},
{
"name": "ondemandcolumns",
"value": ["CustomField_Values:customfields:*"]
}
]
}
Example Response#
{
"success": 1,
"data": {
"total_count": 6,
"start_offset": 0,
"data": [
{
"id": 1,
"parent_id": 0,
"code": "category_01",
"name": "Category 1",
"page_title": "",
"url": "https://local.coolcommerce.net:4444/mm5/merchant.mvc?Screen=CTGY&Category_Code=category_01",
"children": [
{
"id": 5,
"parent_id": 1,
"code": "sub-cat-1",
"name": "Sub Category 1",
"page_title": "",
"url": "https://local.coolcommerce.net:4444/mm5/merchant.mvc?Screen=CTGY&Category_Code=sub-cat-1"
},
{
"id": 6,
"parent_id": 1,
"code": "sub-cat-2",
"name": "Sub Category 2",
"page_title": "",
"url": "https://local.coolcommerce.net:4444/mm5/merchant.mvc?Screen=CTGY&Category_Code=sub-cat-2"
}
]
},
{
"id": 2,
"parent_id": 0,
"code": "category_02",
"name": "Category 2",
"page_title": "",
"url": "https://local.coolcommerce.net:4444/mm5/merchant.mvc?Screen=CTGY&Category_Code=category_02",
"children": [
{
"id": 7,
"parent_id": 2,
"code": "sub-cat-3",
"name": "Sub Category 3",
"page_title": "",
"url": "https://local.coolcommerce.net:4444/mm5/merchant.mvc?Screen=CTGY&Category_Code=sub-cat-3"
},
{
"id": 8,
"parent_id": 2,
"code": "sub-cat-4",
"name": "Sub Category 4",
"page_title": "",
"url": "https://local.coolcommerce.net:4444/mm5/merchant.mvc?Screen=CTGY&Category_Code=sub-cat-4"
}
]
},
{
"id": 3,
"parent_id": 0,
"code": "category_03",
"name": "Category 3",
"page_title": "",
"url": "https://local.coolcommerce.net:4444/mm5/merchant.mvc?Screen=CTGY&Category_Code=category_03"
},
{
"id": 4,
"parent_id": 0,
"code": "category_04",
"name": "Category 4",
"page_title": "",
"url": "https://local.coolcommerce.net:4444/mm5/merchant.mvc?Screen=CTGY&Category_Code=category_04"
},
{
"id": 9,
"parent_id": 0,
"code": "sale",
"name": "Sale",
"page_title": "",
"url": "https://local.coolcommerce.net:4444/mm5/merchant.mvc?Screen=CTGY&Category_Code=sale"
},
{
"id": 10,
"parent_id": 0,
"code": "featured",
"name": "Featured Products",
"page_title": "",
"url": "https://local.coolcommerce.net:4444/mm5/merchant.mvc?Screen=CTGY&Category_Code=featured"
}
]
}
}