example-data.com
Menu
Browse docs and collections

Overview

food-orders / #420

food-orders #420

userId
Jaylon Conroy @jaylon_conroy22
restaurantId
Cummings and Sons · Rodriguezville · ★ 3.5
items
              [
  {
    "menuItemId": 534,
    "quantity": 3,
    "unitPrice": 21.23,
    "lineTotal": 63.69
  },
  {
    "menuItemId": 531,
    "quantity": 1,
    "unitPrice": 45.97,
    "lineTotal": 45.97
  },
  {
    "menuItemId": 550,
    "quantity": 2,
    "unitPrice": 65.28,
    "lineTotal": 130.56
  },
  {
    "menuItemId": 535,
    "quantity": 4,
    "unitPrice": 70.69,
    "lineTotal": 282.76
  },
  {
    "menuItemId": 543,
    "quantity": 4,
    "unitPrice": 26.3,
    "lineTotal": 105.2
  }
]
            
subtotal
628.18
deliveryFee
7.85
tip
1.97
total
638
currency
USD
status
delivered
placedAt
deliveredAt

Component variants

Related

Request

curl example

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

JavaScript example

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

Python example

import requests

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

Response

{
  "id": 420,
  "userId": 205,
  "restaurantId": 37,
  "items": [
    {
      "menuItemId": 534,
      "quantity": 3,
      "unitPrice": 21.23,
      "lineTotal": 63.69
    },
    {
      "menuItemId": 531,
      "quantity": 1,
      "unitPrice": 45.97,
      "lineTotal": 45.97
    },
    {
      "menuItemId": 550,
      "quantity": 2,
      "unitPrice": 65.28,
      "lineTotal": 130.56
    },
    {
      "menuItemId": 535,
      "quantity": 4,
      "unitPrice": 70.69,
      "lineTotal": 282.76
    },
    {
      "menuItemId": 543,
      "quantity": 4,
      "unitPrice": 26.3,
      "lineTotal": 105.2
    }
  ],
  "subtotal": 628.18,
  "deliveryFee": 7.85,
  "tip": 1.97,
  "total": 638,
  "currency": "USD",
  "status": "delivered",
  "placedAt": "2024-08-13T03:06:28.887Z",
  "deliveredAt": "2024-08-13T05:19:38.161Z"
}