example-data.com
Menu
Browse docs and collections

Overview

food-orders / #473

Component variants

Related

Request

curl example

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

JavaScript example

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

Python example

import requests

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

Response

{
  "id": 473,
  "userId": 71,
  "restaurantId": 66,
  "items": [
    {
      "menuItemId": 996,
      "quantity": 1,
      "unitPrice": 62.11,
      "lineTotal": 62.11
    }
  ],
  "subtotal": 62.11,
  "deliveryFee": 2.69,
  "tip": 11.64,
  "total": 76.44,
  "currency": "USD",
  "status": "delivered",
  "placedAt": "2024-11-16T19:11:23.462Z",
  "deliveredAt": "2024-11-16T22:35:59.517Z"
}