example-data.com
Menu
Browse docs and collections

Overview

food-orders / #387

food-orders #387

userId
Lawrence Rogahn @lawrence_rogahn33
restaurantId
Blanda and Sons · New Odashire · ★ 4.1
items
              [
  {
    "menuItemId": 902,
    "quantity": 1,
    "unitPrice": 11.61,
    "lineTotal": 11.61
  },
  {
    "menuItemId": 900,
    "quantity": 3,
    "unitPrice": 31.5,
    "lineTotal": 94.5
  },
  {
    "menuItemId": 897,
    "quantity": 2,
    "unitPrice": 27.35,
    "lineTotal": 54.7
  },
  {
    "menuItemId": 903,
    "quantity": 4,
    "unitPrice": 53.71,
    "lineTotal": 214.84
  }
]
            
subtotal
375.65
deliveryFee
3.55
tip
10.11
total
389.31
currency
USD
status
cancelled
placedAt
deliveredAt

Component variants

Related

Request

curl example

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

JavaScript example

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

Python example

import requests

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

Response

{
  "id": 387,
  "userId": 245,
  "restaurantId": 59,
  "items": [
    {
      "menuItemId": 902,
      "quantity": 1,
      "unitPrice": 11.61,
      "lineTotal": 11.61
    },
    {
      "menuItemId": 900,
      "quantity": 3,
      "unitPrice": 31.5,
      "lineTotal": 94.5
    },
    {
      "menuItemId": 897,
      "quantity": 2,
      "unitPrice": 27.35,
      "lineTotal": 54.7
    },
    {
      "menuItemId": 903,
      "quantity": 4,
      "unitPrice": 53.71,
      "lineTotal": 214.84
    }
  ],
  "subtotal": 375.65,
  "deliveryFee": 3.55,
  "tip": 10.11,
  "total": 389.31,
  "currency": "USD",
  "status": "cancelled",
  "placedAt": "2024-06-12T20:20:16.679Z",
  "deliveredAt": null
}