example-data.com
Menu
Browse docs and collections

Overview

restaurants / #18

Component variants

Related

Request

curl example

curl -sS \
  "https://example-data.com/api/v1/restaurants/18" \
  -H "Accept: application/json"

JavaScript example

const res = await fetch(
  "https://example-data.com/api/v1/restaurants/18"
);
const restaurant = await res.json();

TypeScript example

// Download once: mkdir -p types && curl -o types/restaurants.d.ts https://example-data.com/types/restaurants.d.ts
import type { Restaurant } from "./types/restaurants";

const res = await fetch(
  "https://example-data.com/api/v1/restaurants/18"
);
const restaurant = (await res.json()) as Restaurant;

Python example

import requests

res = requests.get(
    "https://example-data.com/api/v1/restaurants/18"
)
restaurant = res.json()

Response

{
  "id": 18,
  "name": "Halvorson - Torp",
  "slug": "halvorson-torp-18",
  "cuisine": "vietnamese",
  "priceRange": "$$$$",
  "rating": 3.3,
  "ratingCount": 762,
  "countryAlpha2": "GR",
  "city": "Tonawanda",
  "neighborhood": "Derbyshire",
  "address": "152 Kirsten Crescent",
  "phone": "+1 202-555-0117 ext 1",
  "website": "https://halvorson-torp-18.example.com",
  "hasDelivery": true,
  "isOpen": true,
  "latitude": 16.625279,
  "longitude": 85.272556,
  "createdAt": "2024-10-12T06:39:37.011Z",
  "updatedAt": "2024-10-12T06:39:37.011Z"
}