API Reference¶
The CEMA Warehouse provides RESTful API endpoints that allow developers to programmatically access datasets without downloading files locally. This maintains a single source of truth and enables real-time data integration.
Base URL¶
Authentication¶
Currently, most read operations are publicly accessible. Write operations however can be doen within the analytic tools using siple SQL DML commands given user access to the database endpoints given on request.
Endpoints Overview¶
Data Access Endpoints¶
Get Dataset by Category and Table¶
Parameters:
category(string): Data category (Demography, Health_Systems, Health_Status, Accessibility, Diseases, Animal_Health)table_name(string): Specific table/dataset nameformat(string): Response format (csv,json)
Example Request:
Example Response:
List Tables in Category¶
Geospatial Data¶
Access Shapefiles¶
You can easily navigate to the shapefiles page to access the shapefiles API and zipped files to work with the data locallly.
Access Raster Data¶
You can easily navigate to the raster file page to access/download the raster files.
Publications and Documents¶
List Publications¶
Response Formats¶
CSV Format¶
Direct CSV output suitable for immediate use in analysis tools.
JSON Format¶
Structured JSON response with metadata:
{
"metadata": {
"category": "Demography",
"table": "2019_birth_rates",
"records": 47
},
"data": [
{
"county": "Nairobi",
"birth_rate": 25.89
}
]
}
Rate Limiting¶
Currently the rate limiting enforced is 4GB, but please be considerate:
- Limit requests to reasonable frequencies
- Cache data locally when possible
- Contact me for high-volume usage requirements
Error Handling¶
Common HTTP Status Codes¶
| Code | Meaning | Description |
|---|---|---|
| 200 | OK | Request successful |
| 404 | Not Found | Dataset or category not found |
| 400 | Bad Request | Invalid parameters on the file being uploaded. Incorrect file formarts |
| 500 | Server Error | Internal server error:please contact me |
Best Practices¶
- Cache Results: Store frequently accessed datasets locally to reduce API calls
- Use Appropriate Format: Choose CSV for analysis, JSON for web applications
- Validate Data: Always validate data structure before processing
In code example¶
Python integration R integration
Support and Feedback¶
For API support, feature requests, or bug reports, please contact.