example-data.com
Menu
Browse docs and collections

Overview

food-orders / #370

Component variants

Related

Request

curl example

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

JavaScript example

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

Python example

import requests

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

Response

{
  "id": 370,
  "userId": 237,
  "restaurantId": 62,
  "items": [
    {
      "menuItemId": 941,
      "quantity": 4,
      "unitPrice": 44.97,
      "lineTotal": 179.88
    }
  ],
  "subtotal": 179.88,
  "deliveryFee": 0.7,
  "tip": 0.82,
  "total": 181.4,
  "currency": "USD",
  "status": "placed",
  "placedAt": "2024-10-01T14:35:07.033Z",
  "deliveredAt": null
}