example-data.com
Menu
Browse docs and collections

Overview

food-orders / #442

Component variants

Related

Request

curl example

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

JavaScript example

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

Python example

import requests

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

Response

{
  "id": 442,
  "userId": 244,
  "restaurantId": 80,
  "items": [
    {
      "menuItemId": 1185,
      "quantity": 4,
      "unitPrice": 44.13,
      "lineTotal": 176.52
    }
  ],
  "subtotal": 176.52,
  "deliveryFee": 0.94,
  "tip": 5.74,
  "total": 183.2,
  "currency": "USD",
  "status": "delivered",
  "placedAt": "2024-08-06T14:12:39.855Z",
  "deliveredAt": "2024-08-06T16:11:06.512Z"
}