example-data.com
Menu
Browse docs and collections

Overview

food-orders / #424

Component variants

Related

Request

curl example

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

JavaScript example

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

Python example

import requests

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

Response

{
  "id": 424,
  "userId": 74,
  "restaurantId": 32,
  "items": [
    {
      "menuItemId": 478,
      "quantity": 2,
      "unitPrice": 27.27,
      "lineTotal": 54.54
    }
  ],
  "subtotal": 54.54,
  "deliveryFee": 1.54,
  "tip": 4.97,
  "total": 61.05,
  "currency": "USD",
  "status": "delivered",
  "placedAt": "2024-10-18T22:21:40.766Z",
  "deliveredAt": "2024-10-19T00:14:39.715Z"
}