List a location's government bodies - Hamlet API
List a location's government bodies
cURL
curl --request GET \
--url 'https://api.myhamlet.com/v1/locations/{uuid}/government-bodies?per_page=50' \
--header 'Authorization: Bearer <token>'
Python
import requests
url = "https://api.myhamlet.com/v1/locations/{uuid}/government-bodies?per_page=50"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)
JavaScript (Fetch)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.myhamlet.com/v1/locations/{uuid}/government-bodies?per_page=50', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.myhamlet.com/v1/locations/{uuid}/government-bodies?per_page=50",
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;
}
?>
Go
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.myhamlet.com/v1/locations/{uuid}/government-bodies?per_page=50"
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))
}
Java (Unirest)
HttpResponse<String> response = Unirest.get("https://api.myhamlet.com/v1/locations/{uuid}/government-bodies?per_page=50")
.header("Authorization", "Bearer <token>")
.asString();
Ruby
require 'uri'
require 'net/http'
url = URI("https://api.myhamlet.com/v1/locations/{uuid}/government-bodies?per_page=50")
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
Responses
Example Response (Success)
{
"data": [
{
"uuid": "c30d2f7e-9a1b-4c5d-8e6f-0a1b2c3d4e5f",
"location_uuid": "5f2b0c3a-1d4e-4a8b-9f6d-2a1c3e4b5d6f",
"type": "CITY_COUNCIL",
"name": "City Council",
"created_at": "2025-01-10T00:00:00.000Z",
"updated_at": "2026-04-18T12:05:00.000Z"
}
],
"next_cursor": "eyJ1IjoiMjAyNi0wNS0wMSAxODoyMjoxMCIsImkiOjQyfQ"
}
Example Response (Error)
{
"error": {
"code": "not_found",
"message": "The requested resource was not found."
}
}
Authorizations
- Authorization:
- Type: string
- Location: header
- Required: Bearer authentication header of the form
Bearer <token>, where <token> is your auth token.
Path Parameters
- uuid: string
- Required: The location's public uuid.
- Example:
"5f2b0c3a-1d4e-4a8b-9f6d-2a1c3e4b5d6f"
Query Parameters
- per_page: integer
- Default: 50
- Maximum number of items to return per page.
- Required range:
1 <= x <= 100
- Example:
50
- cursor: string
- Opaque pagination cursor from a previous response's
next_cursor. Omit for the first page.
- updated_since: string
- Inclusive lower bound on
updated_at. Returns only records changed at or after this time.
- Example:
"2026-05-01T18:22:10Z"
Response
- 200 - application/json
- Response structure includes the data and next_cursor.