example-data.com
Menu
Browse docs and collections

Overview

food-orders / #287

food-orders #287

userId
Abdul Rau @abdul.rau
restaurantId
Bergstrom LLC · South Gate · ★ 3.0
items
              [
  {
    "menuItemId": 998,
    "quantity": 2,
    "unitPrice": 25.06,
    "lineTotal": 50.12
  },
  {
    "menuItemId": 1001,
    "quantity": 4,
    "unitPrice": 79.86,
    "lineTotal": 319.44
  },
  {
    "menuItemId": 999,
    "quantity": 2,
    "unitPrice": 38.75,
    "lineTotal": 77.5
  },
  {
    "menuItemId": 993,
    "quantity": 1,
    "unitPrice": 27.62,
    "lineTotal": 27.62
  },
  {
    "menuItemId": 1002,
    "quantity": 3,
    "unitPrice": 9.03,
    "lineTotal": 27.09
  }
]
            
subtotal
501.77
deliveryFee
7.69
tip
9.78
total
519.24
currency
USD
status
delivered
placedAt
deliveredAt

Component variants

Related

Request

curl example

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

JavaScript example

const res = await fetch(
  "https://example-data.com/api/v1/food-orders/287"
);
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/287"
);
const foodOrder = (await res.json()) as FoodOrder;

Python example

import requests

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

Response

{
  "id": 287,
  "userId": 108,
  "restaurantId": 66,
  "items": [
    {
      "menuItemId": 998,
      "quantity": 2,
      "unitPrice": 25.06,
      "lineTotal": 50.12
    },
    {
      "menuItemId": 1001,
      "quantity": 4,
      "unitPrice": 79.86,
      "lineTotal": 319.44
    },
    {
      "menuItemId": 999,
      "quantity": 2,
      "unitPrice": 38.75,
      "lineTotal": 77.5
    },
    {
      "menuItemId": 993,
      "quantity": 1,
      "unitPrice": 27.62,
      "lineTotal": 27.62
    },
    {
      "menuItemId": 1002,
      "quantity": 3,
      "unitPrice": 9.03,
      "lineTotal": 27.09
    }
  ],
  "subtotal": 501.77,
  "deliveryFee": 7.69,
  "tip": 9.78,
  "total": 519.24,
  "currency": "USD",
  "status": "delivered",
  "placedAt": "2024-10-29T10:47:36.664Z",
  "deliveredAt": "2024-10-29T13:16:38.471Z"
}