example-data.com
Menu
Browse docs and collections

Overview

food-orders / #483

Component variants

Related

Request

curl example

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

JavaScript example

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

Python example

import requests

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

Response

{
  "id": 483,
  "userId": 6,
  "restaurantId": 70,
  "items": [
    {
      "menuItemId": 1053,
      "quantity": 4,
      "unitPrice": 16.71,
      "lineTotal": 66.84
    }
  ],
  "subtotal": 66.84,
  "deliveryFee": 4.24,
  "tip": 9.5,
  "total": 80.58,
  "currency": "USD",
  "status": "delivered",
  "placedAt": "2024-10-15T18:42:11.327Z",
  "deliveredAt": "2024-10-15T20:26:15.563Z"
}