This document describes how to use the EATLAB API to retrieve data from EATLAB, to add information into the system and to instruct EATLAB to execute actions. This overview section presents a list of all available function calls.
Subscribe
Creates a corresponding user in EATLAB database
GetBranchInformation
Returns the most recent available information of the branch or outlet location
GetMealTimeInformation
Returns the most recent details on the available mealtime of the branch or outlet location
GetSaleChannelInformation
Returns all available sales channels of the branch or outlet location
AddTransactions
Updates database with transactions data to keep model outputs up to date
GetDiscountedSet
Returns an output array containing details of the volume-driven promotional campaign
GetDiscountedSetByBranchId
Returns an output array containing details of the volume-driven promotional campaign by outlet's ID
GetDiscountedSetBySaleChannel
Returns an output array containing details of the volume-driven promotional campaign by sales channel
GetDiscountedSetByMealTime
Returns an output array containing details of the volume-driven promotional campaign by meal time
GetNonDiscountedSet
Returns an output array containing details of the value-based, no-discount promotional campaign
GetNonDiscountedSetByBranchID
Returns an output array containing details of the value-based, no-discount promotional campaign by outlet's ID
GetNonDiscountedSetBySaleChannel
Returns an output array containing details of the value-based, no-discount promotional campaign by sales channel
GetNonDiscountedSetByMealTime
Returns an output array containing details of the value-based, no-discount promotional campaign by meal time
GetBundleSet
Returns an output array containing details of the margin-based promotional campaign
GetBundleSetByBranchID
Returns an output array containing details of the margin-based promotional campaign by outlet's ID
GetBundleSetBySaleChannel
Returns an output array containing details of the margin-based promotional campaign by sales channel
GetBundleSetByMealTime
Returns an output array containing details of the margin-based promotional campaign by meal time
GetBuyXGetYSet
Returns an output array containing details of the conditional promotional campaign
GetBuyXGetYSetByBranchID
Returns an output array containing details of the conditional promotional campaign by outlet's ID
GetBuyXGetYSetBySaleChannel
Returns an output array containing details of the conditional promotional campaign by sales channel
GetBuyXGetYSetByMealTime
Returns an output array containing details of the conditional promotional campaign by meal time
GetOptimizedSet
Returns an output array containing details of the most optimized promotional campaign
GetOptimizedSetByBranchID
Returns an output array containing details of the most optimized promotional campaign by outlet's ID
GetOptimizedSetBySaleChannel
Returns an output array containing details of the most optimized promotional campaign by sales channel
GetOptimizedSetByMealTime
Returns an output array containing details of the most optimized promotional campaign by meal time
GetSortingMenu
Returns an output array containing details of the sequence of menu items that should be displayed to maximize conversion rate
GetSortingMenuByBranchID
Returns an output array containing details of the sequence of menu items that should be displayed to maximize conversion rate by outlet's ID
GetSortingMenuBySaleChannel
Returns an output array containing details of the sequence of menu items that should be displayed to maximize conversion rate by sales channel
GetSortingMenuByMealTime
Returns an output array containing details of the sequence of menu items that should be displayed to maximize conversion rate by meal time
GetSearchableListByDiscount
Returns an array of available discount ranges to be used as an input to
the GetDiscountedSetByDiscount function
GetDiscountedSetByDiscount
Returns the volume-driven promotion suggestions by the specified discount range
GetSearchableListByMenuName
Returns an array of available menu names to be used as an input to the GetDiscountedSetByMenuName function
GetDiscountedSetByMenuName
Returns the volume-driven promotion suggestions that contain the specified menu name
In order to access an API you must create a JWT token by composing a API key and secret by use following step:
Header
JWT must have a header which is algo is HS256 which we use to produce and check correction of the token. other algorithm may produce unexpected result from our API
typ is JWT
{
"alg": "HS256",
"typ": "JWT"
}
Payload
The payload must contains two claims. which is holding the information of user identity and expiration time. iss, the issuer of the token which is API key exp, is the expiration timestamp of the token in seconds in Epoch format
{
"iss": "API_KEY",
"exp": 1661829197
}
Signature
The algorithm of signature must use HMACSHA256 by contains the Payload and Header and using you API Secret to encrypt the JWT token.
HMACSHA256(
base64UrlEncode(header) + "." +
base64UrlEncode(payload),
API_SECRET)
Ref: https://jwt.io/
Note
You can use any JWT libs to sign the token. Please make sure you're setting the header and payload correctly according to the above instruction.
All data values passed to/from the API are of one of the following data types:
An empty response from any function indicates that the inputs were valid, but no data exists.
A successful API call will return a response code of 200 (success). However, any unsuccessful call shall return one of the following codes: