Skip to main content

GET /api/events

Retrieve a list of all events in Dzaleka Refugee Camp.

Query Parameters

This endpoint does not require any query parameters.

Response Format

string
required
Status of the API response (“success” or “error”)
number
required
Total number of events returned
object
required
Container for the events data
array
required
Array of event objects
string
Unique identifier for the event
string
Collection name (“events”)
string
Event title
string
Event description
string
Event start date and time (ISO 8601 format)
string
Event end date (YYYY-MM-DD)
string
Event location (e.g., “Online”, “Dzaleka Community Center”)
string
Event category (e.g., “Zoom Meeting”, “Workshop”, “Conference”)
string
URL to event image
Whether the event is featured
string
Name of the organizing entity
string
Event status (“upcoming”, “ongoing”, “past”)
object
Contact information
string
Contact email
string
Contact phone number
string
WhatsApp number
object
Registration details
boolean
Whether registration is required
string
Registration URL
string
Registration deadline (YYYY-MM-DD)
array
Array of tag strings

Error Responses

string
“error”
string
Error message description
string
Detailed error information
Status Codes:
  • 200 - Success
  • 429 - Rate limit exceeded (60 requests per minute)
  • 500 - Internal server error

Rate Limiting

All API endpoints are rate-limited to 60 requests per minute per IP address. Rate limit headers are included in responses:
  • X-RateLimit-Limit: Maximum requests per window
  • X-RateLimit-Remaining: Remaining requests in current window
  • X-RateLimit-Reset: Timestamp when the rate limit resets
  • Retry-After: Seconds to wait before retrying (only on 429 responses)

Example Request

Example Response

POST /api/events

Retrieve events data with optional metadata and statistics.

Request Body

object
Optional configuration for the response
boolean
Include export metadata in response
boolean
Include statistics in response

Response Format

Same as GET endpoint, with optional additional fields:
object
Export metadata (only if includeMetadata: true)
string
ISO 8601 timestamp of export
string
Collection name
object
Statistics (only if includeStats: true)
number
Total number of items
string
Collection name

Example Request

Example Response

Implementation

The Events API is implemented using the createGetHandler and createPostHandler utility functions from src/utils/api-utils.ts:118. Source code: src/pages/api/events.ts:5