Skip to content

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

https://warehouse.cema.africa/

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

GET /data/{category}/table/{table_name}?format={format}

Parameters:

  • category (string): Data category (Demography, Health_Systems, Health_Status, Accessibility, Diseases, Animal_Health)
  • table_name (string): Specific table/dataset name
  • format (string): Response format (csv, json)

Example Request:

GET api/data/Demography/table/2019_birth_rates?format=csv

Example Response:

county,birth_rate
Nairobi,25.88
Mombasa,24.93
Kisumu,23.89

List Tables in Category

GET /api/tables/{filename}

Geospatial Data

Access Shapefiles

GET /api/shapefiles/{filename}

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

GET /raster

You can easily navigate to the raster file page to access/download the raster files.

Publications and Documents

List Publications

GET /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

  1. Cache Results: Store frequently accessed datasets locally to reduce API calls
  2. Use Appropriate Format: Choose CSV for analysis, JSON for web applications
  3. 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.