example-data.com
Menu
Browse docs and collections

Overview

food-orders / #33

Component variants

Related

Request

curl example

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

JavaScript example

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

Python example

import requests

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

Response

{
  "id": 33,
  "userId": 54,
  "restaurantId": 41,
  "items": [
    {
      "menuItemId": 597,
      "quantity": 1,
      "unitPrice": 46.35,
      "lineTotal": 46.35
    }
  ],
  "subtotal": 46.35,
  "deliveryFee": 5.57,
  "tip": 11.55,
  "total": 63.47,
  "currency": "USD",
  "status": "delivered",
  "placedAt": "2024-10-01T01:05:41.341Z",
  "deliveredAt": "2024-10-01T04:43:29.305Z"
}