Regions
Regions are the top level of the geographic hierarchy.
Geographic hierarchy
Region → Sector → Municipality → Locality
GET /api/regions
Retrieves the list of regions.
Endpoint
GET /api/regions
Headers
| Header | Value | Required |
|---|---|---|
| Authorization | Bearer {token} | Yes |
Success response
Code: 200 OK
{
"@context": "/api/contexts/Region",
"@id": "/api/regions",
"@type": "hydra:Collection",
"hydra:totalItems": 14,
"hydra:member": [
{
"@id": "/api/regions/990e8400-e29b-41d4-a716-446655440001",
"@type": "Region",
"id": "990e8400-e29b-41d4-a716-446655440001",
"nom": "Dakar",
"code": "DK"
},
{
"@id": "/api/regions/990e8400-e29b-41d4-a716-446655440002",
"@type": "Region",
"id": "990e8400-e29b-41d4-a716-446655440002",
"nom": "Thiès",
"code": "TH"
},
{
"@id": "/api/regions/990e8400-e29b-41d4-a716-446655440003",
"@type": "Region",
"id": "990e8400-e29b-41d4-a716-446655440003",
"nom": "Saint-Louis",
"code": "SL"
}
]
}
GET /api/regions/{id}
Retrieves a region by its identifier.
Endpoint
GET /api/regions/{id}
Success response
Code: 200 OK
{
"@context": "/api/contexts/Region",
"@id": "/api/regions/990e8400-e29b-41d4-a716-446655440001",
"@type": "Region",
"id": "990e8400-e29b-41d4-a716-446655440001",
"nom": "Dakar",
"code": "DK"
}
Examples
cURL
# List of regions
curl https://sig.ucp-pch.org/api/regions \
-H "Authorization: Bearer TOKEN"
# Region by ID
curl https://sig.ucp-pch.org/api/regions/990e8400-e29b-41d4-a716-446655440001 \
-H "Authorization: Bearer TOKEN"
JavaScript
const getRegions = async () => {
const response = await fetch(
'https://sig.ucp-pch.org/api/regions',
{
headers: {
'Authorization': `Bearer ${localStorage.getItem('token')}`
}
}
);
return response.json();
};
// Usage
const regions = await getRegions();
regions['hydra:member'].forEach(region => {
console.log(`${region.code}: ${region.nom}`);
});
Python
import requests
def get_regions(token):
response = requests.get(
'https://sig.ucp-pch.org/api/regions',
headers={'Authorization': f'Bearer {token}'}
)
return response.json()
# Usage
regions = get_regions(token)
for region in regions['hydra:member']:
print(f"{region['code']}: {region['nom']}")
Fields
| Field | Type | Description |
|---|---|---|
| id | UUID | Unique identifier |
| nom | string | Region name |
| code | string | Region code (e.g., DK, TH) |
Notes
- Regions are read-only for standard users
- Creation/modification requires the ADMIN role
- Used as reference for filtering households and beneficiaries