example-data.com
Menu
Browse docs and collections

Overview

countries / #42

Egypt

EG

Capital: Cairo · Region: Africa

Component variants

Request

curl example

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

JavaScript example

const res = await fetch(
  "https://example-data.com/api/v1/countries/42"
);
const country = await res.json();

TypeScript example

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

const res = await fetch(
  "https://example-data.com/api/v1/countries/42"
);
const country = (await res.json()) as Country;

Python example

import requests

res = requests.get(
    "https://example-data.com/api/v1/countries/42"
)
countrie = res.json()

Response

{
  "id": 42,
  "name": "Egypt",
  "alpha2": "EG",
  "alpha3": "EGY",
  "numericCode": "818",
  "capital": "Cairo",
  "region": "Africa",
  "subregion": "Northern Africa",
  "currencyCode": "EGP",
  "callingCode": "+20",
  "flagEmoji": "🇪🇬"
}