example-data.com
Menu
Browse docs and collections

Overview

food-orders / #450

food-orders #450

userId
Marcelina Grady @marcelina_grady19
restaurantId
Robel, Walter and Davis · Honolulu · ★ 4.4
items
              [
  {
    "menuItemId": 12,
    "quantity": 3,
    "unitPrice": 38.79,
    "lineTotal": 116.37
  },
  {
    "menuItemId": 24,
    "quantity": 1,
    "unitPrice": 40.98,
    "lineTotal": 40.98
  }
]
            
subtotal
157.35
deliveryFee
2.56
tip
2.57
total
162.48
currency
USD
status
delivered
placedAt
deliveredAt

Component variants

Related

Request

curl example

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

JavaScript example

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

Python example

import requests

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

Response

{
  "id": 450,
  "userId": 241,
  "restaurantId": 2,
  "items": [
    {
      "menuItemId": 12,
      "quantity": 3,
      "unitPrice": 38.79,
      "lineTotal": 116.37
    },
    {
      "menuItemId": 24,
      "quantity": 1,
      "unitPrice": 40.98,
      "lineTotal": 40.98
    }
  ],
  "subtotal": 157.35,
  "deliveryFee": 2.56,
  "tip": 2.57,
  "total": 162.48,
  "currency": "USD",
  "status": "delivered",
  "placedAt": "2024-05-23T15:44:28.123Z",
  "deliveredAt": "2024-05-23T19:14:52.762Z"
}