Sample Flows
This article shares an example flow that could support a use case for the Operations API.
Create an operation for a restaurant's online ordering service
In the app you're developing, that focuses on enhancing a restaurant's online capabilities, there's a feature that implements online orders for the restaurant's catering service.
This flow outlines how to use the Operations API to create this service.
Step 1 | Define your fulfillment methods
Use the Fulfillment Methods API to define the restaurant's fulfillment methods.
Make sure to keep a record of the fulfillment method's ID.
Step 2 | Create your operation
Use Create Operation to establish your operation.
The app creates an operation with the following parameters:
- Customers must submit orders at least 3 days in advance, but no more than 14 days in advance.
- Orders will be fulfilled in two-hours windows, such as Thursday 8:00-10:00.
JSON for the body of your Create Operation request
1{2 "name": "Online Ordering",3 "enabled": true,4 "profile_id": "825065c1-7512-4735-b5df-62bba3070a2e",5 "default": false,6 "onlineOrderingStatus": "ENABLED",7 "orderScheduling": {8 "type": "PREORDER",9 "preorderOptions": {10 "method": {11 "type": "TIME_BOUNDED",12 "timeBoundedOptions": {13 "minTimeInAdvance": {14 "timeUnit": "DAYS",15 "duration": 316 },17 "maxTimeInAdvance": {18 "timeUnit": "DAYS",19 "duration": 1420 }21 }22 },23 "fulfillmentTimesDisplay": {24 "type": "TIME_WINDOWS",25 "timeWindowsOptions": {26 "timeUnit": "HOURS",27 "duration": 228 }29 }30 }31 }32}
Step 3 | Restaurant is ready to accept orders
Before the restaurant starts selling, ensure your operation is enabled and that online ordering status is set to ENABLED
.
Your operation is ready, and the restaurant can start taking online catering orders.