United States
US
Capital: Washington, D.C. · Region: Americas
Overview
countries / #1
US
Capital: Washington, D.C. · Region: Americas
Request
curl example
curl -sS \ "https://example-data.com/api/v1/countries/1" \ -H "Accept: application/json"
JavaScript example
const res = await fetch( "https://example-data.com/api/v1/countries/1" ); 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/1"
);
const country = (await res.json()) as Country; Python example
import requests
res = requests.get(
"https://example-data.com/api/v1/countries/1"
)
countrie = res.json() Response
{
"id": 1,
"name": "United States",
"alpha2": "US",
"alpha3": "USA",
"numericCode": "840",
"capital": "Washington, D.C.",
"region": "Americas",
"subregion": "Northern America",
"currencyCode": "USD",
"callingCode": "+1",
"flagEmoji": "🇺🇸"
}