API Documentation

Integrate CWAS with your applications using our REST API.

Authentication

All API requests require authentication via session cookies. Log in through the web interface first.

Endpoints

GET/api/slots/{date}/{source_id}

Get available time slots for a specific date and water source.

Parameters

date - Date in YYYY-MM-DD format
source_id - Water source ID

Response

[{"id": 1, "start_time": "06:00", "end_time": "06:30", "max_capacity": 10, "booked_count": 3}]
GET/api/districts/{region}

Get list of districts for a region.

Response

["Antananarivo", "Ankazobe", "Anjozorobe"]
POST/api/chat

Send a message to the AI chatbot.

Request Body

{"message": "What is my balance?"}

Response

{"response": "Your current balance is 50,000 Ar.", "intent": "balance"}
GET/api/reports/bookings

Get booking statistics for reporting.

Query Parameters

period - Number of days (default: 30)

Rate Limits

API requests are limited to 100 requests per minute per user.