Biklo for developersTESTsandbox-api.biklo.comchange

Counties of a country

GET/v1/geo/counties

scope catalog.read

The second level of every address. postal_prefixes lists the code prefixes valid for that county where we enforce the rule (Romania today).

Query parameters#

NameExample
countryROISO country code — required

Response#

FieldTypeDescription
countrystringThe country these counties belong to.
countintegerHow many counties.
dataarrayThe first administrative level — județ, province, region — for the given country.
data[].idintegerWhat you send as county_id.
data[].codestringThe short official code, such as DJ.
data[].namestringThe name in local script. For countries not written in Latin this is the local spelling, and it is what you should match against.
data[].latin_namestringA Latin transliteration, for display where the local script will not render.
data[].country_codestringISO-2 of the country.
data[].postal_prefixesstring[]Which postal codes start here. A postal code is checked against the prefix for its county, so this is how to tell in advance whether a code and a county agree.

Example

{
    "country": "RO",
    "count": 42,
    "data": [
        {
            "id": 1,
            "code": "DJ",
            "name": "Dolj",
            "latin_name": "Dolj",
            "country_code": "RO",
            "postal_prefixes": [
                "20"
            ]
        }
    ]
}

Failures use the shared error envelope — a machine-readable code and a request_id to quote to support. Error handling.

curl -X GET "https://sandbox-api.biklo.com/v1/geo/counties?country=RO" \
  -H "Authorization: Bearer bk_test_YOUR_KEY"
<?php

$ch = curl_init('https://sandbox-api.biklo.com/v1/geo/counties?country=RO');

curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST  => 'GET',
    CURLOPT_HTTPHEADER     => [
        'Authorization: Bearer bk_test_YOUR_KEY',
    ],
]);

$response = json_decode(curl_exec($ch), true);
curl_close($ch);
using System.Net.Http;
using System.Net.Http.Headers;

var client = new HttpClient();
client.DefaultRequestHeaders.Authorization =
    new AuthenticationHeaderValue("Bearer", "bk_test_YOUR_KEY");

var request = new HttpRequestMessage(
    new HttpMethod("GET"),
    "https://sandbox-api.biklo.com/v1/geo/counties?country=RO");

var response = await client.SendAsync(request);
var json = await response.Content.ReadAsStringAsync();
import requests

response = requests.get(
    "https://sandbox-api.biklo.com/v1/geo/counties?country=RO",
    headers={"Authorization": "Bearer bk_test_YOUR_KEY"},
)

data = response.json()
const response = await fetch("https://sandbox-api.biklo.com/v1/geo/counties?country=RO", {
  method: "GET",
  headers: {
    Authorization: "Bearer bk_test_YOUR_KEY"
  }
});

const data = await response.json();
import java.net.http.*;
import java.net.URI;

var client = HttpClient.newHttpClient();

var request = HttpRequest.newBuilder()
    .uri(URI.create("https://sandbox-api.biklo.com/v1/geo/counties?country=RO"))
    .header("Authorization", "Bearer bk_test_YOUR_KEY")
    .method("GET", HttpRequest.BodyPublishers.noBody())
    .build();

var response = client.send(request, HttpResponse.BodyHandlers.ofString());