Accounts
Get Cities
Lists the cities. Use the name in constitutionCity when registering a user, and the id where a city ID is required.
This endpoint is public: it does not require an access token.
Response
An array of cities:
| Field | Description |
|---|---|
| id | City identifier. |
| name | City name. |
| department | Department, state or province. |
| countryId | Country of the city. |
GET
/
api
/
helpers
/
cities
Get Cities
curl --request GET \
--url https://testapi.kravata.co/api/helpers/cities \
--header 'Authorization: Bearer <token>'import requests
url = "https://testapi.kravata.co/api/helpers/cities"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://testapi.kravata.co/api/helpers/cities', 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://testapi.kravata.co/api/helpers/cities",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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://testapi.kravata.co/api/helpers/cities"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://testapi.kravata.co/api/helpers/cities")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://testapi.kravata.co/api/helpers/cities")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body[
{
"id": 3,
"name": "Cartagena",
"department": "Bolivar",
"countryId": 8
},
{
"id": 4,
"name": "Armenia",
"department": "Quindio",
"countryId": 8
},
{
"id": 5,
"name": "Nechi",
"department": "Antioquia",
"countryId": 8
}
]Get Cities
curl --request GET \
--url https://testapi.kravata.co/api/helpers/cities \
--header 'Authorization: Bearer <token>'import requests
url = "https://testapi.kravata.co/api/helpers/cities"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://testapi.kravata.co/api/helpers/cities', 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://testapi.kravata.co/api/helpers/cities",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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://testapi.kravata.co/api/helpers/cities"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://testapi.kravata.co/api/helpers/cities")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://testapi.kravata.co/api/helpers/cities")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body[
{
"id": 3,
"name": "Cartagena",
"department": "Bolivar",
"countryId": 8
},
{
"id": 4,
"name": "Armenia",
"department": "Quindio",
"countryId": 8
},
{
"id": 5,
"name": "Nechi",
"department": "Antioquia",
"countryId": 8
}
]
