oedb-backend/doc/api_endpoints.md
2025-09-26 17:38:30 +02:00

160 lines
No EOL
4.7 KiB
Markdown

# API Endpoints Documentation
This document provides a comprehensive list of all API endpoints available in the OpenEventDatabase (OEDB) backend.
## Main API Endpoints
### Root Endpoint
- **URL**: `/`
- **Method**: GET
- **Description**: Provides general information about the API, including version and available endpoints.
- **Response**: JSON object with API information.
### Event Endpoints
#### Get Events
- **URL**: `/event`
- **Method**: GET
- **Description**: Retrieves a collection of events based on query parameters.
- **Query Parameters**:
- `what`: Filter events by type (e.g., `sport.match.football`)
- `when`: Filter events by time period (e.g., `last7days`, `today`, `tomorrow`)
- `limit`: Maximum number of events to return (default: 100)
- `bbox`: Bounding box for geographic filtering (format: `min_lon,min_lat,max_lon,max_lat`)
- **Response**: GeoJSON FeatureCollection of events.
#### Create Event
- **URL**: `/event`
- **Method**: POST
- **Description**: Creates a new event.
- **Request Body**: GeoJSON Feature representing the event.
- **Response**: JSON object with the created event ID.
#### Get Event by ID
- **URL**: `/event/{id}`
- **Method**: GET
- **Description**: Retrieves a specific event by its ID.
- **Response**: GeoJSON Feature of the requested event.
#### Update Event
- **URL**: `/event/{id}`
- **Method**: PUT
- **Description**: Updates an existing event.
- **Request Body**: GeoJSON Feature with updated event data.
- **Response**: JSON object with the updated event ID.
#### Delete Event
- **URL**: `/event/{id}`
- **Method**: DELETE
- **Description**: Deletes an event by its ID.
- **Response**: JSON object confirming deletion.
#### Search Events
- **URL**: `/event/search`
- **Method**: GET
- **Description**: Advanced search for events with more complex filtering options.
- **Query Parameters**: Various search parameters (see `/doc/api_search.md` for details).
- **Response**: GeoJSON FeatureCollection of matching events.
### Statistics Endpoint
- **URL**: `/stats`
- **Method**: GET
- **Description**: Provides statistics about the database, including event counts and recent updates.
- **Response**: JSON object with statistics.
### RSS Feeds
#### Latest Events RSS
- **URL**: `/rss`
- **Method**: GET
- **Description**: Provides an RSS feed of the latest 200 events.
- **Response**: XML RSS feed.
#### Events by Family RSS
- **URL**: `/rss/by/{family}`
- **Method**: GET
- **Description**: Provides an RSS feed of events filtered by family (e.g., sport, culture).
- **Response**: XML RSS feed.
### Database Dumps
#### List Database Dumps
- **URL**: `/db/dumps`
- **Method**: GET
- **Description**: Lists all available database dumps.
- **Response**: JSON object with list of dumps.
#### Create Database Dumps
- **URL**: `/db/dumps/create`
- **Method**: POST
- **Description**: Creates new database dumps in SQL and GeoJSON formats.
- **Response**: JSON object with information about the created dumps.
## Demo/UI Endpoints
These endpoints provide web interfaces for interacting with the API:
### Main Demo Page
- **URL**: `/demo`
- **Method**: GET
- **Description**: Main demo page with a map interface to explore events.
### Event Submission Form
- **URL**: `/demo/add`
- **Method**: GET
- **Description**: Form for submitting new events.
### Events by Type
- **URL**: `/demo/by-what`
- **Method**: GET
- **Description**: Page showing events grouped by their type.
### Map by Event Type
- **URL**: `/demo/map-by-what`
- **Method**: GET
- **Description**: Map interface showing events colored by their type.
### Event Editing
- **URL**: `/demo/edit/{id}`
- **Method**: GET
- **Description**: Interface for editing an existing event.
### View Event by ID
- **URL**: `/demo/by_id/{id}`
- **Method**: GET
- **Description**: Page showing details of a specific event.
### Traffic Jam Reporting
- **URL**: `/demo/traffic`
- **Method**: GET
- **Description**: Interface for reporting traffic jams.
### View Saved Events
- **URL**: `/demo/view-events`
- **Method**: GET
- **Description**: Page showing events saved by the user.
### Statistics by Event Type
- **URL**: `/demo/stats`
- **Method**: GET
- **Description**: Page showing statistics grouped by event type.
### Live Events
- **URL**: `/demo/live`
- **Method**: GET
- **Description**: Real-time view of events with auto-refresh.
## Static Files
- **URL**: `/static/`
- **Method**: GET
- **Description**: Serves static files (CSS, JavaScript, images) for the demo interfaces.
## Additional Documentation
For more detailed information about specific aspects of the API, refer to these documents:
- [API Query Parameters](/doc/api_query_params.md)
- [API Search](/doc/api_search.md)
- [API Load Testing](/doc/api_load_test.md)
- [Anti-Spam Measures](/doc/anti_spam.md)
- [Demo Endpoint](/doc/demo_endpoint.md)