example-data.com
Menu
Browse docs and collections

Overview

food-orders / #401

Component variants

Related

Request

curl example

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

JavaScript example

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

Python example

import requests

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

Response

{
  "id": 401,
  "userId": 38,
  "restaurantId": 60,
  "items": [
    {
      "menuItemId": 920,
      "quantity": 1,
      "unitPrice": 25.58,
      "lineTotal": 25.58
    }
  ],
  "subtotal": 25.58,
  "deliveryFee": 4.24,
  "tip": 8.59,
  "total": 38.41,
  "currency": "USD",
  "status": "delivered",
  "placedAt": "2024-08-21T03:30:08.691Z",
  "deliveredAt": "2024-08-21T05:47:24.804Z"
}