Synchronize a store
This topic demonstrates the implementation of the syncStore API for synchronizing a store.
Overview
Insert all information under a store with one API call, including the store information, menus, categories, items, modifier groups, and SKUs.
Inputs to the API
To insert data for a store, menu, category, item, or modifier group, you must pass certain mandatory parameters and associated values in the syncStore API call.
The mandatory parameters are highlighted below:
- store: storeId, name, type, location, contacts, and serviceSchedules.
- menu: menuId, name, and type.
- category: categoryId and name.
- item: itemId, name, saleType, and saleAmount.
- modifierGroup: groupId, name, quantityRule, and childItems.
Note: To understand the data models and parameters in the request and response body, refer to syncStore and Data dictionary.
Use case
The following demonstrates a sample store structure:
- The store (
20221017storeid01
), namedstore01
in English, is a brand restaurant (brandId:Test Brand
) and supports pickup. - The store opens from 8:00-22:00 every day.
- The store contains a pickup menu (
menu_id_01
), a category (category_id_01
), a single item (300009
) with SKU information, a modifier group (MODIFIERGROUP01
), and an add-on item (201002||300009||@CD
).
copy
{
"requestId": "2022112221****",
"appId": "21020101154****",
"store": {
"storeId": "20221017storeid01",
"type": "RESTAURANT",
"brandId": "Test Brand",
"name": {
"value": {
"en-US": "store01"
}
},
"location": {
"address": {
"value": {
"en-US": "123 Braddell Tech, Lorong 8 Toa Payoh #12-14, 319123, Singapore"
}
},
"latitude": "1.339953",
"longitude": "103.858048"
},
"status": "OPEN",
"contacts": [
{
"name": {
"value": {
"en-US": "will"
}
},
"phoneNo": "+6582110449***"
},
{
"name": {
"value": {
"en-US": "will"
}
},
"phoneNo": "+658211044****"
}
],
"contents": [
{
"type": "TEXT",
"scene": "ANNOUNCEMENT",
"value": "{\"value\":{\"en-US\":\"store01\"}}"
},
{
"type": "IMAGE",
"scene": "BACKGROUND",
"value": "https://omni.posplus-crm.com/Omni_FnbItem/storeabc/NSDLX_DBBF_AC.png"
},
{
"type": "TEXT",
"scene": "DESCRIPTION",
"value": "{\"value\":{\"en-US\":\"store01\"}}"
}
],
"serviceSchedules": [
{
"scheduleType": "DAILY",
"schedules": {
"FIXED": [
{
"startTime": "8:00+08:00",
"endTime": "22:00+08:00"
}
]
}
}
],
"bizRules": [
{
"scene": "PICKUP_SCHEDULE",
"ruleData": "[{\"scheduleType\":\"DAILY\",\"supportDays\":2,\"schedules\":{\"FIXED\":[{\"startTime\":\"10:00+08:00\",\"endTime\":\"11:00+08:00\"},{\"startTime\":\"12:00+08:00\",\"endTime\":\"13:00+08:00\"}]}}]"
},
{
"scene": "PICKUP_RULE",
"ruleData": "[{\"minimumOrderAmount\":{\"value\":1000,\"currency\":\"SGD\"},\"pickUpContactDetails\":[{\"name\":{\"value\":{\"en-US\":\"Sample Brand @ Braddell\"}},\"phoneNo\":\"+6562539***\"}],\"pickUpAddress\":{\"value\":{\"en-US\":\"15 Braddell****, L*****\"}}}]"
}
],
"extendInfo": {
"recommendItemIds": [
"item_id_01"
],
"banners": [
{
"imageUrl": "https://s3-ap-southeast-1.example.com/test0(2).png",
"landingUrl": "https://s3-ap-southeast-1.example.com"
}
],
"cuisine": {
"value": {
"en-US": "Sample Brand @ Braddell"
}
},
"tags": [
"CU_CAKES_BAKERY",
"CU_DIM_SUM",
"CU_CHINESE"
]
},
"menus": [
{
"menuId": "menu_id_01",
"name": {
"value": {
"en-US": "Beakfast"
}
},
"status": "VALID",
"type": "PICKUP",
"minPrepareMinutes": 15,
"categories": [
{
"categoryId": "category_id_01",
"name": {
"value": {
"en-US": "Limited Time Offer"
}
},
"iconUrl": "https://www.example.com/images/antfincdn/cdZOWIR73/0011icon.jpg",
"status": "ACTIVE",
"extendInfo": {
"subtitle": {
"value": {
"en-US": "Main Course"
}
}
},
"items": [
{
"itemId": "300009",
"name": {
"value": {
"en-US": "Nachos Deluxe Double Beef"
}
},
"status": "AVAILABLE",
"saleType": "SINGLE",
"originAmount": {
"currency": "SGD",
"value": "30000"
},
"saleAmount": {
"currency": "SGD",
"value": "1350"
},
"quantityRule": {
"min": 0,
"max": 99
},
"skuPropertyGroups": [
{
"name": {
"value": {
"en-US": "size"
}
},
"skuGroupId": "27731",
"properties": [
{
"name": {
"value": {
"en-US": "Small"
}
},
"propertyId": "Small"
},
{
"name": {
"value": {
"en-US": "Large"
}
},
"propertyId": "Large"
}
]
},
{
"skuGroupId": "27733",
"name": {
"value": {
"en-US": "Level of Spiciness"
}
},
"properties": [
{
"name": {
"value": {
"en-US": "No Chili"
}
},
"propertyId": "No Chili"
},
{
"name": {
"value": {
"en-US": "less Chili"
}
},
"propertyId": "Less Chili"
},
{
"name": {
"value": {
"en-US": "Normal Chili"
}
},
"propertyId": "Normal Spicy"
}
]
}
],
"skus": [
{
"skuId": "tsku2121",
"skuPropertyPairs": {
"27731": "Small",
"27733": "Normal Spicy"
},
"originAmount": {
"currency": "SGD",
"value": 100
},
"saleAmount": {
"currency": "SGD",
"value": 90
},
"contents": [
{
"type": "IMAGE",
"scene": "BACKGROUND",
"value": "https://www.example.com/images/uploads/meals/test.JPG"
}
]
},
{
"skuId": "tsku2122",
"skuPropertyPairs": {
"27731": "Large",
"27733": "Normal Spicy"
},
"originAmount": {
"currency": "SGD",
"value": 100
},
"saleAmount": {
"currency": "SGD",
"value": 80
},
"contents": [
{
"type": "IMAGE",
"scene": "BACKGROUND",
"value": "https://wwww.example.com/images/uploads/meals/test.png"
}
]
}
],
"contents": [
{
"type": "IMAGE",
"scene": "BACKGROUND",
"value": "https://omni.posplus-crm.com/Omni_FnbItem/bkmy/storeabc.png"
},
{
"type": "TEXT",
"scene": "DESCRIPTION",
"value": "{\"value\":{\"en-US\":\"delicious food\"}}"
}
],
"extendInfo": {
"subTitle": {
"value": {
"en-US": "delicious chicken"
}
},
"takeAwayFee": {
"currency": "SGD",
"value": 100
},
"serviceSchedules": [
{
"scheduleType": "DAILY",
"schedules": {
"FIXED": [
{
"startTime": "00:00+08:00",
"endTime": "23:59+08:00"
}
]
}
}
]
},
"modifierGroups": [
{
"groupId": "MODIFIERGROUP01",
"name": {
"value": {
"en-US": "Add-On"
}
},
"quantityRule": {
"min": 0,
"max": 12
},
"childItems": [
{
"itemId": "201002||300009||@CD",
"name": {
"value": {
"en-US": "Add Beef Patty"
}
},
"saleType": "ADDON",
"originAmount": {
"currency": "SGD",
"value": 0
},
"saleAmount": {
"currency": "SGD",
"value": 350
}
}
]
}
]
}
]
}
]
}
]
}
}