example-data.com
Menu
Browse docs and collections

Overview

food-orders / #178

Component variants

Related

Request

curl example

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

JavaScript example

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

Python example

import requests

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

Response

{
  "id": 178,
  "userId": 225,
  "restaurantId": 1,
  "items": [
    {
      "menuItemId": 5,
      "quantity": 1,
      "unitPrice": 16.36,
      "lineTotal": 16.36
    }
  ],
  "subtotal": 16.36,
  "deliveryFee": 1.92,
  "tip": 0.78,
  "total": 19.06,
  "currency": "USD",
  "status": "delivered",
  "placedAt": "2025-01-09T10:34:13.593Z",
  "deliveredAt": "2025-01-09T11:49:57.340Z"
}