example-data.com
Menu
Browse docs and collections

Overview

food-orders / #451

Component variants

Related

Request

curl example

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

JavaScript example

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

Python example

import requests

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

Response

{
  "id": 451,
  "userId": 200,
  "restaurantId": 41,
  "items": [
    {
      "menuItemId": 591,
      "quantity": 1,
      "unitPrice": 53.05,
      "lineTotal": 53.05
    }
  ],
  "subtotal": 53.05,
  "deliveryFee": 3.19,
  "tip": 2.84,
  "total": 59.08,
  "currency": "USD",
  "status": "delivered",
  "placedAt": "2024-12-24T06:37:43.261Z",
  "deliveredAt": "2024-12-24T07:56:07.194Z"
}