-
Notifications
You must be signed in to change notification settings - Fork 0
API Docs
The /init2
API call was created to keep backwards compatibility with existing users. You should use this call going forward, because it's more robust, and it includes the ability to include/exclude things depending on what you need. Init2 also can include the new /gatekeeper
API for your bootup sequence.
Options are now appended as URL parameters, instead of the /arg1/arg2 structure. e.g.: /init2/arg1=foo&arg2=bar.
Possible URL parameters
- copy=1|0: Whether or not to include copy. Defaults to 1.
- date={date}: Same usage as existing init.
- gatekeeper=1: Defaults to 0. If this is included,
lat
andlong
are also required in order for the gatekeeper API to execute (otherwise nothing will happen).
Examples
- Same as
/init
:/init2
- Same as
/init/{date}
:/init2?date=2015-10-22
- Same as
/init/{date}
, but let's add thegatekeeper
API in there too:/init2?date=2015-10-22&gatekeeper=1&lat=37.76637243960176&long=-122.41473197937012
. Notice that you needgatekeeper=1
- Perhaps you don't need the app copy on every init request. Set copy=0:
/init2?date=2015-10-22©=0&gatekeeper=1&lat=37.76637243960176&long=-122.41473197937012
Let's talk about this new big thing.
What to look at:
-
isInAnyZone: Is the customer even within any service area?
-
AvailableServices: What is currently "on", based on what's set in the admin. The only thing to really look at here is the
OrderAhead
object, which contains everything you need for building the OA menu.- OrderAhead:
- You'll need to pass
kitchen
andzone
back to me when the user sends an OA order. -
availableMenus
is the mothership. That should have everything you need, and it's the same type of format that you've already been using. They're already sorted in the order that they should appear in the dropdown. Also, don't forget to look at the quantities of each item, per menu. So when the user selects "Feb 1 Lunch" versus "Feb 1 Dinner", those are differentqty
's.- Each menu has a
Times
array that tells you how to build the available times selection for a menu, and which are available. Later on "available" could be false, and that time should be marked as "sold out".
- Each menu has a
- You'll need to pass
- OrderAhead:
-
appState. See possibilites here: Logic: appState Decision Tree
-
appOnDemandWidget: Use to build the OD widget!
-
"selected": true|false: Whether or not it defaults to being selected. If false, select the first OA option.
-
"title" and "text": Obvious, hopefully.
-
"state": "open|sold out|closed". Same states as you get now. You don't really need to do anything with this. If the store is sold out, then I go and get the sold_out text, and I set it here as the text. So you don't have to do anything extra.
-
"menuPreview": null|{menuObj}. If the store is closed or sold out, then this will be populated with the menu object that you use to show the user the menu preview (this is equal to the "view menu" button that you would tap on the existing closed/soldout walls--I am just putting it here for ease).
-