example-data.com
Menu
Browse docs and collections

Overview

food-orders / #459

Component variants

Related

Request

curl example

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

JavaScript example

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

Python example

import requests

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

Response

{
  "id": 459,
  "userId": 40,
  "restaurantId": 100,
  "items": [
    {
      "menuItemId": 1444,
      "quantity": 4,
      "unitPrice": 60.6,
      "lineTotal": 242.4
    }
  ],
  "subtotal": 242.4,
  "deliveryFee": 7.8,
  "tip": 11.5,
  "total": 261.7,
  "currency": "USD",
  "status": "delivered",
  "placedAt": "2024-10-25T16:17:45.505Z",
  "deliveredAt": "2024-10-25T19:50:52.717Z"
}