Random country
curl --request GET \
--url https://api.reqi.dev/v1/countries/randomimport requests
url = "https://api.reqi.dev/v1/countries/random"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.reqi.dev/v1/countries/random', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.reqi.dev/v1/countries/random",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.reqi.dev/v1/countries/random"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.reqi.dev/v1/countries/random")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.reqi.dev/v1/countries/random")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body[
{
"name": {
"common": "<string>",
"official": "<string>",
"native": {}
},
"cca2": "<string>",
"cca3": "<string>",
"population": 123,
"flags": {
"svg": "<string>",
"png": "<string>",
"alt": "<string>"
},
"tld": [
"<string>"
],
"ccn3": "<string>",
"cioc": "<string>",
"independent": true,
"status": "<string>",
"unMember": true,
"unRegionalGroup": "<string>",
"wikidataId": "<string>",
"currencies": {},
"capital": [
"<string>"
],
"altSpellings": [
"<string>"
],
"region": "<string>",
"subregion": "<string>",
"languages": {},
"translations": {},
"latlng": [
123
],
"landlocked": true,
"borders": [
"<string>"
],
"area": 123,
"flag": "<string>",
"demonyms": {},
"capitalInfo": {},
"enrichment": {
"fetchedAt": "2023-11-07T05:31:56Z",
"population": {
"value": 123,
"source": "wikidata",
"asOf": "<string>"
},
"economics": {
"gdp": 123,
"gdpPerCapita": 123,
"gdpYear": 123
},
"development": {
"hdi": 123,
"lifeExpectancy": 123,
"gini": 123
},
"government": {
"type": "<string>",
"website": "<string>"
},
"company": {
"name": "<string>",
"wikidataId": "<string>",
"revenue": 123,
"profit": 123,
"asOf": "<string>"
},
"computed": {
"populationDensity": 123,
"capitalPopulationShare": 123
}
},
"holidays": {
"source": "nager.date",
"fetchedAt": "2023-11-07T05:31:56Z",
"years": [
123
],
"items": [
{
"date": "2023-12-25",
"localName": "<string>",
"name": "<string>",
"types": [
"<string>"
]
}
]
},
"maps": {},
"fifa": "<string>",
"timezones": [
"<string>"
],
"continents": [
"<string>"
]
}
]{
"message": "<string>",
"status": 123
}{
"message": "<string>",
"status": 123
}Countries
Random country
Returns one random country as a one-element array, subject to offset/limit.
GET
/
v1
/
countries
/
random
Random country
curl --request GET \
--url https://api.reqi.dev/v1/countries/randomimport requests
url = "https://api.reqi.dev/v1/countries/random"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.reqi.dev/v1/countries/random', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.reqi.dev/v1/countries/random",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.reqi.dev/v1/countries/random"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.reqi.dev/v1/countries/random")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.reqi.dev/v1/countries/random")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body[
{
"name": {
"common": "<string>",
"official": "<string>",
"native": {}
},
"cca2": "<string>",
"cca3": "<string>",
"population": 123,
"flags": {
"svg": "<string>",
"png": "<string>",
"alt": "<string>"
},
"tld": [
"<string>"
],
"ccn3": "<string>",
"cioc": "<string>",
"independent": true,
"status": "<string>",
"unMember": true,
"unRegionalGroup": "<string>",
"wikidataId": "<string>",
"currencies": {},
"capital": [
"<string>"
],
"altSpellings": [
"<string>"
],
"region": "<string>",
"subregion": "<string>",
"languages": {},
"translations": {},
"latlng": [
123
],
"landlocked": true,
"borders": [
"<string>"
],
"area": 123,
"flag": "<string>",
"demonyms": {},
"capitalInfo": {},
"enrichment": {
"fetchedAt": "2023-11-07T05:31:56Z",
"population": {
"value": 123,
"source": "wikidata",
"asOf": "<string>"
},
"economics": {
"gdp": 123,
"gdpPerCapita": 123,
"gdpYear": 123
},
"development": {
"hdi": 123,
"lifeExpectancy": 123,
"gini": 123
},
"government": {
"type": "<string>",
"website": "<string>"
},
"company": {
"name": "<string>",
"wikidataId": "<string>",
"revenue": 123,
"profit": 123,
"asOf": "<string>"
},
"computed": {
"populationDensity": 123,
"capitalPopulationShare": 123
}
},
"holidays": {
"source": "nager.date",
"fetchedAt": "2023-11-07T05:31:56Z",
"years": [
123
],
"items": [
{
"date": "2023-12-25",
"localName": "<string>",
"name": "<string>",
"types": [
"<string>"
]
}
]
},
"maps": {},
"fifa": "<string>",
"timezones": [
"<string>"
],
"continents": [
"<string>"
]
}
]{
"message": "<string>",
"status": 123
}{
"message": "<string>",
"status": 123
}Query Parameters
Comma-separated field list. Supports dot paths (name.common). Use * or omit for the full object.
Page size from 1 to 25. Default 5.
Required range:
1 <= x <= 25Number of matches to skip. Default 0. Used when page is omitted.
Required range:
x >= 0Response
JSON array of country objects (possibly projected).
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes