Introduction
The Dzaleka Online Services API provides programmatic access to community data including services, events, news, jobs, resources, and more. The API is built on Astro and uses a RESTful architecture with JSON responses.The API is currently public and free to use with rate limiting to ensure fair usage.
Base URL
All API requests should be made to:Available Endpoints
The API provides access to the following collections:Services
Community services and organizations
Events
Upcoming and past community events
News
Latest news and announcements
Jobs
Job opportunities and listings
Resources
Educational and community resources
Photos
Community photo gallery
Profiles
Community member profiles
Talents
Showcase of community talents
Weather
Local weather forecast for Dowa district
Search
Search across all collections
API Architecture
Collection Endpoints
Most endpoints follow a standardized pattern using shared utility functions fromsrc/utils/api-utils.ts:118-159:
- GET requests fetch all items in a collection
- POST requests fetch items with optional filters and metadata
- OPTIONS requests handle CORS preflight
Standard Response Format
All successful API responses follow this structure:The exact fields in each data object depend on the collection type. All items include
id and collection fields.Making Requests
GET Request Example
Fetch all services:POST Request Example
Fetch services with metadata:Search Request Example
Search across multiple collections:Error Handling
The API uses standard HTTP status codes and returns errors in a consistent format:Error Response Format
Common HTTP Status Codes
Request completed successfully
Invalid request parameters (e.g., search query too short)
Too many requests. See Rate Limits for details
Server error while processing the request
Error Handling Example
Response Headers
All API responses include standard headers for CORS and caching:X-Cache:HITorMISS(for cached responses)Cache-Control: Caching directives for client-side cachingX-RateLimit-*: Rate limit information (see Rate Limits)
Best Practices
Respect Rate Limits
Respect Rate Limits
Stay within the 60 requests per minute limit. Implement exponential backoff when receiving 429 responses.
Cache Responses
Cache Responses
Many endpoints include
Cache-Control headers. Implement client-side caching to reduce API calls.Handle Errors Gracefully
Handle Errors Gracefully
Always check the
status field in responses and handle errors appropriately.Use POST for Complex Queries
Use POST for Complex Queries
When you need metadata or statistics, use POST requests with the
options parameter.Specify Search Collections
Specify Search Collections
When using the search endpoint, specify only the collections you need to improve performance.