example-data.com
Menu
Browse docs and collections

Overview

food-orders / #304

food-orders #304

userId
Aylin Sanford @aylin.sanford
restaurantId
Hegmann - Daugherty · Dulcestad · ★ 4.6
items
              [
  {
    "menuItemId": 686,
    "quantity": 3,
    "unitPrice": 9.71,
    "lineTotal": 29.13
  },
  {
    "menuItemId": 684,
    "quantity": 2,
    "unitPrice": 69.67,
    "lineTotal": 139.34
  },
  {
    "menuItemId": 696,
    "quantity": 2,
    "unitPrice": 6.89,
    "lineTotal": 13.78
  }
]
            
subtotal
182.25
deliveryFee
4.69
tip
0.1
total
187.04
currency
USD
status
delivered
placedAt
deliveredAt

Component variants

Related

Request

curl example

curl -sS \
  "https://example-data.com/api/v1/food-orders/304" \
  -H "Accept: application/json"

JavaScript example

const res = await fetch(
  "https://example-data.com/api/v1/food-orders/304"
);
const foodOrder = await res.json();

TypeScript example

// Download once: mkdir -p types && curl -o types/food-orders.d.ts https://example-data.com/types/food-orders.d.ts
import type { FoodOrder } from "./types/food-orders";

const res = await fetch(
  "https://example-data.com/api/v1/food-orders/304"
);
const foodOrder = (await res.json()) as FoodOrder;

Python example

import requests

res = requests.get(
    "https://example-data.com/api/v1/food-orders/304"
)
food_order = res.json()

Response

{
  "id": 304,
  "userId": 173,
  "restaurantId": 46,
  "items": [
    {
      "menuItemId": 686,
      "quantity": 3,
      "unitPrice": 9.71,
      "lineTotal": 29.13
    },
    {
      "menuItemId": 684,
      "quantity": 2,
      "unitPrice": 69.67,
      "lineTotal": 139.34
    },
    {
      "menuItemId": 696,
      "quantity": 2,
      "unitPrice": 6.89,
      "lineTotal": 13.78
    }
  ],
  "subtotal": 182.25,
  "deliveryFee": 4.69,
  "tip": 0.1,
  "total": 187.04,
  "currency": "USD",
  "status": "delivered",
  "placedAt": "2024-09-28T11:26:21.366Z",
  "deliveredAt": "2024-09-28T12:43:12.471Z"
}