### Get Prep Station by GUID (Node.js) Source: https://doc.toasttab.com/openapi/kitchen/operation/prepStationsGuidGet This Node.js code snippet provides an example of fetching a prep station's configuration via its GUID. It outlines the necessary HTTP request setup, including authentication and headers. ```javascript // Node.js example would go here, utilizing modules like 'axios' or the built-in 'http' module for the API call. ``` -------------------------------- ### Apply Discount to Order Item (Python) Source: https://doc.toasttab.com/openapi/orders/operation/ordersChecksSelectionsAppliedDiscountsPost Python example demonstrating how to apply a discount to an order item using the requests library. It shows the construction of the request payload and headers. ```python import requests import json url = "https://api.toasttab.com/orders/v2/orders/{orderGuid}/checks/{checkGuid}/selections/{selectionGuid}/appliedDiscounts" headers = { "Authorization": "Basic YOUR_API_KEY", "Content-Type": "application/json" } payload = [ { "name": "Sample Discount", "discountAmount": 5.00, "discountType": "FIXED" } ] response = requests.post(url, headers=headers, data=json.dumps(payload)) print(response.text) ``` -------------------------------- ### BOGO Discount Application Example (JSON) Source: https://doc.toasttab.com/doc/devguide/apiDiscountingOrders Illustrates the structure of an Order object when a BOGO discount is applied. It shows how the discount is associated with the 'get' item and how 'buy' item selections are referenced via triggers. ```json { "entityType":"Order", [contents omitted] }, "checks":[ { "entityType":"Check", "selections":[ { "entityType": "MenuItemSelection", "itemGroup": { "guid": "e0da05d4-db71-44ed-805b-95284d22df73", "entityType": "MenuGroup" }, "item": { "entityType": "MenuItem", "guid": "a8b4439d-185d-41df-8ad3-2ff4f7dfa6ec" }, "quantity": 3, "modifiers": [] } ], "appliedDiscounts": [ { "discount": { "guid": "7e345df5-9b3c-4e5a-9fbe-6183c56d2f88" } } ] } ] } ``` ```json { "entityType": "Order", [contents omitted] "checks": [ { "entityType": "Check", [contents omitted] "appliedDiscounts": [], "selections": [ { "guid": "e0da05d4-db71-44ed-805b-95284d22df73", "entityType": "MenuItemSelection", "itemGroup": { "guid": "46c963b8-a4c8-4cd0-9b7e-e1c431ed0b53", "entityType": "MenuGroup" }, "item": { "guid": "a8b4439d-185d-41df-8ad3-2ff4f7dfa6ec", "entityType": "MenuItem" }, "quantity": 2, "preDiscountPrice": 17.98, "displayName": "Soup", "appliedDiscounts": [], "price": 17.98, [contents omitted] }, { "guid": "2950ded4-f21a-428d-a847-698bcb260c03", "entityType": "MenuItemSelection", "itemGroup": { "guid": "46c963b8-a4c8-4cd0-9b7e-e1c431ed0b53", "entityType": "MenuGroup" }, "item": { "guid": "a8b4439d-185d-41df-8ad3-2ff4f7dfa6ec", "entityType": "MenuItem" }, "quantity": 1, "preDiscountPrice": 8.99, "displayName": "Soup", "appliedDiscounts": [ { "guid": "7ec5c2e8-b6ae-4d30-8084-fecf3dd611f3", "entityType": "AppliedCustomDiscount", "approver": null, "processingState": null, "loyaltyDetails": null, "name": "Enjoy more soup.", "comboItems": [], "discountAmount": 8.99, "discount": { "guid": "7e345df5-9b3c-4e5a-9fbe-6183c56d2f88", "entityType": "Discount" }, "triggers": [ { "selection": { "guid": "e0da05d4-db71-44ed-805b-95284d22df73", "entityType": "MenuItemSelection" }, "quantity": 1 } ], "appliedPromoCode": null } ], "price": 0, [contents omitted] } ``` -------------------------------- ### Get Payment by GUID - Java Example Source: https://doc.toasttab.com/openapi/orders/operation/paymentsGuidGet Example of how to fetch payment details using Java. This snippet would typically involve HTTP client libraries to make the GET request. ```java // Java code example for fetching payment details would go here. // This would typically involve using libraries like Apache HttpClient or OkHttp. ``` -------------------------------- ### Example Packaging Preference Configuration Response (JSON) Source: https://doc.toasttab.com/doc/devguide/apiOrdersPackagingPreferences This JSON object represents the response data from the 'published/packagingConfig' endpoint. It includes configuration details such as whether preferences are enabled, a list of packaging items with their unique IDs and display names, and an optional guest message. ```json { "enabled": true, "items": [ { "id": "0632bedc-9a09-4cd2-9575-f2ff189f5f2e", "itemTypes": [ "UTENSILS", "NAPKINS" ], "guestDisplayName": "Include utensils and napkins", "guestInclusionType": "OPT_IN", "guestDescription": "Include 4 sets of utensils and one pack of napkins" }, { "id": "be9c8aac-9d7f-4ff5-bfdd-f7d2fcb4711f", "itemTypes": [ "BAGS" ], "guestDisplayName": "Pack in plastic bag", "guestInclusionType": "OPT_OUT", "guestDescription": null } ], "guestMessage": "Thank you for helping our restaurant remain eco-friendly!" } ``` -------------------------------- ### Get Break Type by GUID (Node.js) Source: https://doc.toasttab.com/openapi/configuration/operation/breakTypesGuidGet This Node.js example shows how to get a break type configuration using its GUID. It employs the `axios` library to make a GET request to the Toast API, including the required authorization and restaurant identifier headers. ```javascript const axios = require('axios'); const url = 'https://toast-api-server/config/v2/breakTypes/{guid}'; const headers = { 'Authorization': 'Bearer ', 'Toast-Restaurant-External-ID': 'string' }; axios.get(url, { headers: headers }) .then(response => { console.log(response.data); }) .catch(error => { console.error(error); }); ``` -------------------------------- ### Get Price Group by GUID (cURL) Source: https://doc.toasttab.com/openapi/configuration/operation/priceGroupsGuidGet Example using cURL to make a GET request to retrieve a specific price group configuration by its GUID. Requires authentication token and restaurant external ID. ```shell curl -i -X GET \ 'https://toast-api-server/config/v2/priceGroups/{guid}' \ -H 'Authorization: Bearer ' \ -H 'Toast-Restaurant-External-ID: string' ``` -------------------------------- ### Apply Discount to Order Item (C#) Source: https://doc.toasttab.com/openapi/orders/operation/ordersChecksSelectionsAppliedDiscountsPost C# code example for applying a discount to an order item using HttpClient. This demonstrates setting up the request and handling the response. ```csharp using System; using System.Net.Http; using System.Text; using System.Threading.Tasks; public class DiscountApplier { public static async Task ApplyDiscountAsync() { using (var client = new HttpClient()) { client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", "YOUR_API_KEY"); var discountPayload = new[] { new { name = "Sample Discount", discountAmount = 5.00, discountType = "FIXED" } }; var json = System.Text.Json.JsonSerializer.Serialize(discountPayload); var content = new StringContent(json, Encoding.UTF8, "application/json"); var response = await client.PostAsync("https://api.toasttab.com/orders/v2/orders/{orderGuid}/checks/{checkGuid}/selections/{selectionGuid}/appliedDiscounts", content); var responseString = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseString); } } } ``` -------------------------------- ### Get Payment by GUID - C# Example Source: https://doc.toasttab.com/openapi/orders/operation/paymentsGuidGet Provides a C# example for retrieving payment data. This would utilize .NET's HttpClient class to make the API call. ```csharp // C# code example for fetching payment details would go here. // This would typically involve using System.Net.Http.HttpClient. ``` -------------------------------- ### Apply Check-Level Loyalty Discount (JSON) Source: https://doc.toasttab.com/doc/devguide/apiDiscountingOrders This JSON example demonstrates how to apply a loyalty program discount to an entire check. It includes the `appliedLoyaltyInfo` for the customer's loyalty account and `appliedDiscounts` with `loyaltyDetails` for the specific discount to be applied to the check. ```json { "entityType":"Order", "diningOption":{ "guid":"4f4d2103-2e0f-45d7-ae4c-8a9c16648fd1", "entityType":"DiningOption" }, "checks":[ { "entityType":"Check", "customer":{ "email":"fgauthier@example.com", "firstName":"Francis", "lastName":"Gauthier", "phone":"987-654-3210" }, "appliedLoyaltyInfo": { "loyaltyIdentifier": "6000101001599474", "vendor": "INTEGRATION" }, "selections":[ { "entityType":"MenuItemSelection", "itemGroup":{ "guid":"eeebddd6-6556-4c81-bd2b-1d1a1a716a83", "entityType":"MenuGroup" }, "item":{ "entityType":"MenuItem", "guid":"79df2dfb-340d-405f-a0f9-55b882606ce5" }, "quantity":3, "modifiers": [] } ], "appliedDiscounts": [ { "loyaltyDetails": { "vendor": "INTEGRATION", "referenceId": "4" } } ] } ] } ``` -------------------------------- ### Example Menu Data Structure Source: https://doc.toasttab.com/doc/platformguide/adminDataExportFieldReference This example demonstrates the structure of a menu object as it would appear in the data export. It includes fields for identification, online ordering status, visibility, and time-based availability. ```json { "entityType": "Menu", "name": "Food", "guid": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "description": "All food items available for order.", "groups": [], "idString": "MENU_ID_123", "orderableOnline": true, "orderableOnlineStatus": "YES", "visibility": "ALL", "startTime": 41400000, "endTime": 57600000, "startTimeHHmm": "11:30", "endTimeHHmm": "16:00", "startTimeLocalStandardTime": 75600000, "endTimeLocalStandardTime": 93600000, "startTimeHHmmLocalStandardTime": "11:30", "endTimeHHmmLocalStandardTime": "16:00", "availableAllTimes": false, "availableAllDays": true, "daysAvailableString": [ "Mon", "Tues", "Wed", "Thurs", "Fri", "Sat", "Sun" ], "daysAvailableBits": 127, "daysAvailableString": [ "Mon", "Tues", "Wed", "Thurs", "Fri" ] } ``` -------------------------------- ### Get No Sale Reason by GUID (C#) Source: https://doc.toasttab.com/openapi/configuration/operation/noSaleReasonsGuidGet C# code example for retrieving a no sale reason by its GUID. This would utilize .NET's HttpClient to perform the GET request to the Toast API. ```csharp // C# example would go here ``` -------------------------------- ### Get Orders in Bulk using Node.js Source: https://doc.toasttab.com/openapi/orders/operation/ordersBulkGet This Node.js example shows how to fetch orders in bulk using the `axios` library. It demonstrates making a GET request with appropriate headers and query parameters to the Toast API. The response is logged to the console. ```javascript const axios = require('axios'); const url = 'https://toast-api-server/orders/v2/ordersBulk'; const params = { businessDate: 'string', endDate: 'string', page: 0, pageSize: 0, startDate: 'string' }; const headers = { 'Authorization': 'Bearer ', 'Toast-Restaurant-External-ID': 'string' }; axios.get(url, { params, headers }) .then(response => { console.log(response.status); console.log(response.data); }) .catch(error => { console.error('Error fetching orders:', error.response ? error.response.data : error.message); }); ``` -------------------------------- ### Get Discount by GUID (curl) Source: https://doc.toasttab.com/openapi/configuration/operation/discountsGuidGet Example using curl to fetch discount details. It requires the discount's GUID and the restaurant's external ID in the headers, along with an authorization token. ```curl curl -i -X GET \ 'https://toast-api-server/config/v2/discounts/{guid}' \ -H 'Authorization: Bearer ' \ -H 'Toast-Restaurant-External-ID: string' ``` -------------------------------- ### AppliedDiscount JSON Structure Example Source: https://doc.toasttab.com/doc/devguide/apiDiscountingOrders This example demonstrates the structure of the `AppliedDiscount` JSON array used when adding discounts. It shows how to include discount GUIDs and optionally apply promotional codes. ```json [ { "discount": { "guid": "a96fd992-9d69-4a62-894f-b621c31127a5" } }, { "discount": { "guid": "30430bb7-0e55-4aae-b783-ee62cda3ca7d" }, "appliedPromoCode": "MYEXTRASPECIALOFFER" } ] ``` -------------------------------- ### Retrieve a Single Order by GUID - cURL Example Source: https://doc.toasttab.com/doc/devguide/apiOrdersGetDetailedInfoAboutOneOrder This example demonstrates how to make a GET request to the `/orders/{guid}` endpoint using cURL to retrieve detailed information about a specific order. Replace `{guid}` with the actual order GUID. Ensure you have the necessary authentication headers. ```shell curl -X GET \ 'https://api.toasttab.com/orders/YOUR_ORDER_GUID' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ -H 'Content-Type: application/json' ``` -------------------------------- ### Get Discount by GUID (Node.js) Source: https://doc.toasttab.com/openapi/configuration/operation/discountsGuidGet Node.js example for retrieving discount information. This snippet demonstrates using the 'axios' library to perform the GET request with appropriate headers. ```javascript const axios = require('axios'); const apiUrl = 'https://toast-api-server/config/v2/discounts/{guid}'; const token = ''; const restaurantExternalId = 'string'; const headers = { 'Authorization': `Bearer ${token}`, 'Toast-Restaurant-External-ID': restaurantExternalId }; axios.get(apiUrl, { headers }) .then(response => { console.log(response.data); }) .catch(error => { console.error('Error fetching discount:', error.response ? error.response.data : error.message); }); ``` -------------------------------- ### Example Restaurant Online Ordering Schedule Configuration Source: https://doc.toasttab.com/doc/devguide/apiRxOnlineOrderingScheduleWebhook This JSON snippet illustrates the configuration for a restaurant's online ordering schedule, including business date, time ranges, maximum scheduled order days, and last order configuration. ```json { "restaurantId": "123e4567-e89b-12d3-a456-426614174000", "onlineOrderingSchedule": { "delivery": [ { "businessDate": 20250531, "timeRanges": [ { "start": [ 9, 0 ], "end": [ 21, 0 ] } ] } ], "scheduledOrderMaxDays": 3, "lastOrderConfiguration": "UNTIL_CLOSING_TIME" } } ``` -------------------------------- ### Get Inventory by Status - URL Examples Source: https://doc.toasttab.com/doc/devguide/apiUsingTheStockApi These examples show the format of the URL to retrieve menu item inventory based on status. You can specify 'QUANTITY' to get items in stock or 'OUT_OF_STOCK' to get items that are not in stock. ```http https://_[toast-api-hostname]_/stock/v1/inventory?status=QUANTITY ``` ```http https://_[toast-api-hostname]_/stock/v1/inventory?status=OUT_OF_STOCK ``` -------------------------------- ### Get Table by GUID (Node.js) Source: https://doc.toasttab.com/openapi/configuration/operation/tablesGuidGet Node.js example for fetching table data. This snippet would utilize a Node.js HTTP client to interact with the Toast API, specifying the table GUID and restaurant ID in the request. ```javascript // Node.js code snippet for getting a table would go here. // This would involve using a library like 'axios' or the built-in 'http' // module to make a GET request to the /tables/{guid} endpoint. ``` -------------------------------- ### Example Order Object for a Scheduled Order Source: https://doc.toasttab.com/doc/devguide/orders_api_future_orders This example demonstrates the structure of an `Order` object configured for future fulfillment, including dates for promising, opening, and payment. ```APIDOC ## POST /orders ### Description Creates a new order that is scheduled for future fulfillment. This endpoint allows specifying dates for when the order should be promised, opened, and paid. ### Method POST ### Endpoint /orders ### Parameters #### Request Body - **entityType** (string) - Required - The type of the entity, should be "Order". - **diningOption** (object) - Required - Specifies the dining option for the order. - **guid** (string) - Required - The unique identifier for the dining option. - **entityType** (string) - Required - The entity type, should be "DiningOption". - **checks** (array) - Required - A list of checks associated with the order. - **entityType** (string) - Required - The type of the entity, should be "Check". - **selections** (array) - Required - A list of menu item selections for the check. - **entityType** (string) - Required - The type of the entity, should be "MenuItemSelection". - **itemGroup** (object) - Required - The menu item group. - **guid** (string) - Required - The unique identifier for the item group. - **entityType** (string) - Required - The entity type, should be "MenuGroup". - **item** (object) - Required - The menu item. - **entityType** (string) - Required - The entity type, should be "MenuItem". - **guid** (string) - Required - The unique identifier for the menu item. - **quantity** (integer) - Required - The quantity of the item. - **modifiers** (array) - Optional - A list of modifiers for the item selection. - **payments** (array) - Required - A list of payments for the check. - **paidDate** (string) - Required - The timestamp when the payment was placed (ISO 8601 format). - **type** (string) - Required - The type of payment (e.g., "OTHER"). - **otherPayment** (object) - Required if type is "OTHER" - Details for other payment types. - **guid** (string) - Required - The unique identifier for the other payment. - **entityType** (string) - Required - The entity type, should be "OtherPayment". - **amount** (number) - Required - The amount paid. - **tipAmount** (number) - Optional - The tip amount for the payment. - **promisedDate** (string) - Required - The date and time when the order will be fulfilled (ISO 8601 format). - **openedDate** (string) - Optional - The business date of the order (ISO 8601 format). If not provided, defaults to the current business date. ### Request Example ```json { "entityType": "Order", "diningOption": { "guid": "23fc2559-fc37-46ce-a963-cc5fdb88af0c", "entityType": "DiningOption" }, "checks": [ { "entityType": "Check", "selections": [ { "entityType": "MenuItemSelection", "itemGroup": { "guid": "46c963b8-a4c8-4cd0-9b7e-e1c431ed0b53", "entityType": "MenuGroup" }, "item": { "entityType": "MenuItem", "guid": "a8b4439d-185d-41df-8ad3-2ff4f7dfa6ec" }, "quantity": 1, "modifiers": [] } ], "payments": [ { "paidDate": "2022-03-01T10:00:00.000+0000", "type": "OTHER", "otherPayment": { "guid": "b9ba25d1-519a-4ea8-ba05-ed1d952b28bf", "entityType": "OtherPayment" }, "amount": 8.63, "tipAmount": 1.02 } ] } ], "promisedDate": "2022-03-05T16:00:00.000+0000", "openedDate": "2022-03-05T16:00:00.000+0000" } ``` ### Response #### Success Response (200 or 201) - **orderGuid** (string) - The unique identifier for the created order. - **status** (string) - The status of the created order. #### Response Example ```json { "orderGuid": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "status": "Scheduled" } ``` ``` -------------------------------- ### Get Service Area - JSON Response Example Source: https://doc.toasttab.com/openapi/configuration/operation/serviceAreasGuidGet This is an example of a successful JSON response when retrieving a `ServiceArea` object. It includes the service area's GUID, entity type, name, and details about its associated revenue center. ```json { "guid": "string", "entityType": "string", "name": "string", "revenueCenter": { "guid": "string", "entityType": "string", "externalId": "string" } } ```