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

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

Error Responses

status
string
“error”
message
string
Error message description
error
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

curl -X GET "https://services.dzaleka.com/api/events" \
  -H "Content-Type: application/json"

Example Response

{
  "status": "success",
  "count": 1,
  "data": {
    "events": [
      {
        "id": "Breaking Myths About Refugees",
        "collection": "events",
        "title": "Breaking Myths About Refugees: Truths That Change Perceptions",
        "description": "Refugees and migrants face misconceptions worldwide, but in this session, we focus on Malawi and the broader sub-Saharan Africa region.",
        "date": "2025-04-24T13:00:00.000Z",
        "endDate": "2025-04-24",
        "location": "Online",
        "category": "Zoom Meeting",
        "image": "https://alumni.creighton.edu/sites/default/files/externals/7fe45be3aa4b9a7e7698f971033cbcc6.jpg",
        "featured": true,
        "organizer": "Inua Advocacy",
        "status": "past",
        "contact": {
          "email": "info@inuaadvocacy.org",
          "phone": "+265 882 717 995",
          "whatsapp": "+265 882 717 995"
        },
        "registration": {
          "required": true,
          "url": "https://us06web.zoom.us/meeting/register/4PrLQ4aMSK6gzSDff2shWw",
          "deadline": "2025-04-24"
        },
        "tags": ["Refugees", "Malawi", "Laws", "Inua Advocacy"]
      }
    ]
  }
}

POST /api/events

Retrieve events data with optional metadata and statistics.

Request Body

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

Response Format

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

Example Request

curl -X POST "https://services.dzaleka.com/api/events" \
  -H "Content-Type: application/json" \
  -d '{
    "options": {
      "includeMetadata": true,
      "includeStats": true
    }
  }'

Example Response

{
  "status": "success",
  "count": 28,
  "data": {
    "events": [
      {
        "id": "Breaking Myths About Refugees",
        "title": "Breaking Myths About Refugees: Truths That Change Perceptions",
        "date": "2025-04-24T13:00:00.000Z",
        "location": "Online"
      }
    ]
  },
  "metadata": {
    "exportDate": "2025-03-09T12:00:00.000Z",
    "collection": "events"
  },
  "stats": {
    "totalItems": 28,
    "collection": "events"
  }
}

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