Skip to main content

GET /api/photos

Retrieve a collection of photo stories and visual narratives from 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 photos returned
data
object
required
Container for the photos data
photos
array
required
Array of photo story objects
id
string
Unique identifier for the photo story
collection
string
Collection name (“photos”)
title
string
Photo story title
description
string
Description or narrative of the photo story
photographer
object
Photographer information
name
string
Photographer’s name
instagram
string
Instagram handle
website
string
Photographer’s website
bio
string
Brief biography
contributor
string
Contributor slug/identifier
image
string
URL to the main image
date
string
Publication date (YYYY-MM-DD)
tags
array
Array of tag strings
Whether the photo story is featured
location
string
Location where the photo was taken

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/photos" \
  -H "Content-Type: application/json"

Example Response

{
  "status": "success",
  "count": 1,
  "data": {
    "photos": [
      {
        "id": "Andy",
        "collection": "photos",
        "title": "From Survival to Innovation: Andy's Journey in Dzaleka",
        "description": "Escaping his past as a child soldier, Andy found refuge in Dzaleka, reunited with his mother, and discovered coding. Now, he dreams of growing his messaging app into something greater.",
        "photographer": {
          "name": "Badre Bahaji",
          "instagram": "badrebahaji",
          "website": "https://mw.linkedin.com/in/badre-bahaji-1bb67942",
          "bio": "Photography based in Uganda"
        },
        "contributor": "badre-bahaji",
        "image": "https://www.wfp.org/sites/default/files/styles/media_embed/public/2021-06/Malawi%205.jpg?itok=NkB_eCtY",
        "date": "2021-06-18",
        "tags": [
          "Former Child Soldier",
          "Refugee Resilience",
          "Family Reunion",
          "Coding Skills"
        ],
        "featured": true,
        "location": "Dzaleka Refugee Camp"
      }
    ]
  }
}

POST /api/photos

Retrieve photos 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/photos" \
  -H "Content-Type: application/json" \
  -d '{
    "options": {
      "includeMetadata": true,
      "includeStats": true
    }
  }'

Example Response

{
  "status": "success",
  "count": 32,
  "data": {
    "photos": [
      {
        "id": "Andy",
        "title": "From Survival to Innovation: Andy's Journey in Dzaleka",
        "photographer": {
          "name": "Badre Bahaji"
        },
        "date": "2021-06-18"
      }
    ]
  },
  "metadata": {
    "exportDate": "2025-03-09T12:00:00.000Z",
    "collection": "photos"
  },
  "stats": {
    "totalItems": 32,
    "collection": "photos"
  }
}

Implementation

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