example-data.com
Menu
Browse docs and collections

Overview

food-orders / #454

food-orders #454

userId
Ken Towne @ken.towne
restaurantId
Medhurst, Effertz and Brown · Franeckiburgh · ★ 3.2
items
              [
  {
    "menuItemId": 1136,
    "quantity": 4,
    "unitPrice": 78.33,
    "lineTotal": 313.32
  },
  {
    "menuItemId": 1141,
    "quantity": 2,
    "unitPrice": 54.38,
    "lineTotal": 108.76
  },
  {
    "menuItemId": 1137,
    "quantity": 2,
    "unitPrice": 74.04,
    "lineTotal": 148.08
  }
]
            
subtotal
570.16
deliveryFee
7.42
tip
6.33
total
583.91
currency
USD
status
delivered
placedAt
deliveredAt

Component variants

Related

Request

curl example

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

JavaScript example

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

Python example

import requests

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

Response

{
  "id": 454,
  "userId": 248,
  "restaurantId": 78,
  "items": [
    {
      "menuItemId": 1136,
      "quantity": 4,
      "unitPrice": 78.33,
      "lineTotal": 313.32
    },
    {
      "menuItemId": 1141,
      "quantity": 2,
      "unitPrice": 54.38,
      "lineTotal": 108.76
    },
    {
      "menuItemId": 1137,
      "quantity": 2,
      "unitPrice": 74.04,
      "lineTotal": 148.08
    }
  ],
  "subtotal": 570.16,
  "deliveryFee": 7.42,
  "tip": 6.33,
  "total": 583.91,
  "currency": "USD",
  "status": "delivered",
  "placedAt": "2024-07-03T03:03:57.015Z",
  "deliveredAt": "2024-07-03T06:21:29.373Z"
}