example-data.com
Menu
Browse docs and collections

countries

countries

Page 2 of 3.

Overview

Request

curl example

curl -sS \
  "https://example-data.com/api/v1/countries?limit=25"

JavaScript example

const res = await fetch(
  "https://example-data.com/api/v1/countries?limit=25"
);
const { data, meta } = 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, ListEnvelope } from "./types/countries";

const res = await fetch(
  "https://example-data.com/api/v1/countries?limit=25"
);
const { data, meta } = (await res.json()) as ListEnvelope<Country>;

Python example

import requests

res = requests.get(
    "https://example-data.com/api/v1/countries",
    params={"limit": 25},
)
data = res.json()

Response

{
  "data": [
    {
      "id": 25,
      "name": "Switzerland",
      "alpha2": "CH",
      "alpha3": "CHE",
      "numericCode": "756",
      "capital": "Bern",
      "region": "Europe",
      "subregion": "Western Europe",
      "currencyCode": "CHF",
      "callingCode": "+41",
      "flagEmoji": "🇨🇭"
    },
    {
      "id": 26,
      "name": "Austria",
      "alpha2": "AT",
      "alpha3": "AUT",
      "numericCode": "040",
      "capital": "Vienna",
      "region": "Europe",
      "subregion": "Western Europe",
      "currencyCode": "EUR",
      "callingCode": "+43",
      "flagEmoji": "🇦🇹"
    },
    {
      "id": 27,
      "name": "Japan",
      "alpha2": "JP",
      "alpha3": "JPN",
      "numericCode": "392",
      "capital": "Tokyo",
      "region": "Asia",
      "subregion": "Eastern Asia",
      "currencyCode": "JPY",
      "callingCode": "+81",
      "flagEmoji": "🇯🇵"
    }
  ],
  "meta": {
    "page": 2,
    "limit": 24,
    "total": 50,
    "totalPages": 3
  },
  "links": {
    "self": "/api/v1/countries?page=2&limit=24",
    "first": "/api/v1/countries?page=1&limit=24",
    "last": "/api/v1/countries?page=3&limit=24",
    "next": "/api/v1/countries?page=3&limit=24",
    "prev": "/api/v1/countries?page=1&limit=24"
  }
}