example-data.com
Menu
Browse docs and collections

Overview

food-orders / #43

Component variants

Related

Request

curl example

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

JavaScript example

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

Python example

import requests

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

Response

{
  "id": 43,
  "userId": 10,
  "restaurantId": 9,
  "items": [
    {
      "menuItemId": 125,
      "quantity": 3,
      "unitPrice": 10.21,
      "lineTotal": 30.63
    },
    {
      "menuItemId": 134,
      "quantity": 3,
      "unitPrice": 38.88,
      "lineTotal": 116.64
    }
  ],
  "subtotal": 147.27,
  "deliveryFee": 0.29,
  "tip": 6.96,
  "total": 154.52,
  "currency": "USD",
  "status": "cancelled",
  "placedAt": "2024-06-15T04:14:39.300Z",
  "deliveredAt": null
}