oedb-backend/swagger.json
2021-11-14 23:48:06 +01:00

305 lines
7.3 KiB
JSON

{
"swagger": "2.0",
"info": {
"description": "Public API for the OpenEventDatabase project",
"version": "0.0.1",
"title": "OpenEventDatabase",
"contact": {
"name": "OpenEventDatabase API Team"
},
"license": {
"name": "AGPL",
"url": "http://www.gnu.org/licenses/"
}
},
"host": "api.openeventdatabase.org",
"basePath": "/",
"tags": [
{
"name": "Statistics",
"description": "Operations about API statistics"
},
{
"name": "Events",
"description": "Operations about events"
}
],
"schemes": [
"https"
],
"paths": {
"/event": {
"get": {
"tags": [
"Events"
],
"consumes": [],
"produces": [
"application/json"
],
"parameters": [
{
"name": "what",
"in": "query",
"description": "Event hierarchical keyword search",
"required": false,
"type": "string",
"x-example": "weather.alert.wind"
},
{
"name": "when",
"in": "query",
"description": "Event time search",
"required": false,
"type": "string",
"format": "date",
"x-example": "2016-05-01 12:00:00+00"
},
{
"name": "start",
"in": "query",
"description": "Event time range search (stop is required)",
"required": false,
"type": "string",
"format": "date",
"x-example": "2016-05-01 12:00:00+00"
},
{
"name": "stop",
"in": "query",
"description": "Event time range search (start is required)",
"required": false,
"type": "string",
"format": "date",
"x-example": "2016-05-01 12:00:00+00"
},
{
"name": "bbox",
"in": "query",
"description": "Event geographic bounding box search (East, South, West, North)",
"required": false,
"type": "string",
"x-example": "-3.0,45.0,9.0,52.0"
},
{
"name": "near",
"in": "query",
"description": "Event search by distance (long, lat, optional distance in meters)",
"required": false,
"type": "string",
"x-example": "2.5,48.8,500"
}
],
"responses": {
"200": {
"description": "List of event as geojson FeatureCollection",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Event"
}
}
}
}
},
"post": {
"tags": [
"Events"
],
"summary": "Create a new event",
"description": "Create a new event",
"operationId": "placeOrder",
"consumes": [
"application/json"
],
"produces": [],
"parameters": [
{
"in": "body",
"name": "body",
"required": false,
"schema": {
"$ref": "#/definitions/Event"
}
}
],
"responses": {
"200": {
"description": "Success"
},
"400": {
"description": "Error 400"
},
"500": {
"description": "Internal Server Error 500"
},
}
}
},
"/event/{id}": {
"get": {
"tags": [
"Events"
],
"summary": "Get details about a single event",
"description": "Get details about a single event",
"operationId": "getOrderById",
"consumes": [],
"produces": [
"application/json"
],
"parameters": [
{
"name": "id",
"in": "path",
"description": "Id of event",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "Success",
"schema": {
"$ref": "#/definitions/Event"
}
},
"400": {
"description": "Error 400"
},
"404": {
"description": "Error 404"
},
"500": {
"description": "Internal Server Error 500"
},
}
}
},
"/stats": {
"get": {
"tags": [
"Statistics"
],
"consumes": [],
"produces": [],
"parameters": [],
"responses": {
"200": {
"description": "OK"
}
}
}
}
},
"definitions": {
"EventGeometry": {
"type": "object",
"required": [
"type"
],
"properties": {
"type": {
"type": "string",
"description": "Geometry type: Point"
},
"coordinates": {
"description": "Geometry coordinates (longitude; latitude)",
"type": "array",
"items": {
"type": "number",
"format": "float",
"maxItems": 2,
"minItems": 2
}
}
}
},
"EventProperties": {
"type": "object",
"required": [
"id",
"type",
"what"
],
"properties": {
"createdate": {
"type": "string",
"format": "date",
"description": "Event creation timestamp"
},
"id": {
"type": "string",
"description": "Event UUID"
},
"label": {
"type": "string",
"description": "Event label"
},
"lastupdate": {
"type": "string",
"format": "date",
"description": "Event last modification timestamp"
},
"lat": {
"type": "number",
"description": "Event location latitude"
},
"lon": {
"type": "number",
"description": "Event location longitude"
},
"source": {
"type": "string",
"description": "Event source"
},
"start": {
"type": "string",
"format": "date",
"description": "Event start timestamp"
},
"stop": {
"type": "string",
"format": "date",
"description": "Event stop timestamp"
},
"type": {
"type": "string",
"description": "Event type",
"enum": ["scheduled", "forecast", "unscheduled"]
},
"what": {
"type": "string",
"description": "Event hierarchical keyword based description"
},
"when": {
"type": "string",
"format": "date",
"description": "Event timestamp"
}
}
},
"Event": {
"type": "object",
"required": [
"geometry",
"properties",
"type"
],
"properties": {
"geometry": {
"$ref": "#/definitions/EventGeometry"
},
"properties": {
"$ref": "#/definitions/EventProperties"
},
"type":
{
"description": "Type of event",
"type": "string",
"enum": ["Feature"]
}
}
}
}
}