example-data.com
Menu
Browse docs and collections

Overview

food-orders / #2

Component variants

Related

Request

curl example

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

JavaScript example

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

Python example

import requests

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

Response

{
  "id": 2,
  "userId": 164,
  "restaurantId": 8,
  "items": [
    {
      "menuItemId": 100,
      "quantity": 4,
      "unitPrice": 55.87,
      "lineTotal": 223.48
    },
    {
      "menuItemId": 105,
      "quantity": 4,
      "unitPrice": 22.74,
      "lineTotal": 90.96
    }
  ],
  "subtotal": 314.44,
  "deliveryFee": 1.67,
  "tip": 6.13,
  "total": 322.24,
  "currency": "USD",
  "status": "cancelled",
  "placedAt": "2025-01-18T16:51:21.069Z",
  "deliveredAt": null
}