Files
next-tjwater-agent/openapi/openapi.json
T

1580 lines
37 KiB
JSON

{
"openapi": "3.1.0",
"info": {
"title": "Next TJWater Data API",
"version": "0.1.0"
},
"paths": {
"/api/v1/meta/projects": {
"get": {
"tags": [
"projects"
],
"summary": "Projects",
"operationId": "projects_api_v1_meta_projects_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"items": {
"$ref": "#/components/schemas/ProjectSummaryResponse"
},
"type": "array",
"title": "Response Projects Api V1 Meta Projects Get"
}
}
}
}
},
"security": [
{
"OAuth2PasswordBearer": []
}
]
}
},
"/api/v1/meta/project": {
"get": {
"tags": [
"projects"
],
"summary": "Project",
"operationId": "project_api_v1_meta_project_get",
"security": [
{
"OAuth2PasswordBearer": []
}
],
"parameters": [
{
"name": "X-Project-Id",
"in": "header",
"required": false,
"schema": {
"anyOf": [
{
"type": "string",
"format": "uuid"
},
{
"type": "null"
}
],
"title": "X-Project-Id"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProjectMetaResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/api/v1/meta/db/health": {
"get": {
"tags": [
"projects"
],
"summary": "Health",
"operationId": "health_api_v1_meta_db_health_get",
"security": [
{
"OAuth2PasswordBearer": []
}
],
"parameters": [
{
"name": "X-Project-Id",
"in": "header",
"required": false,
"schema": {
"anyOf": [
{
"type": "string",
"format": "uuid"
},
{
"type": "null"
}
],
"title": "X-Project-Id"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DatabaseHealthResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/api/v1/monitoring/devices": {
"get": {
"tags": [
"monitoring"
],
"summary": "Devices",
"operationId": "devices_api_v1_monitoring_devices_get",
"security": [
{
"OAuth2PasswordBearer": []
}
],
"parameters": [
{
"name": "X-Project-Id",
"in": "header",
"required": false,
"schema": {
"anyOf": [
{
"type": "string",
"format": "uuid"
},
{
"type": "null"
}
],
"title": "X-Project-Id"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/DeviceOut"
},
"title": "Response Devices Api V1 Monitoring Devices Get"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/api/v1/monitoring/points": {
"get": {
"tags": [
"monitoring"
],
"summary": "Points",
"operationId": "points_api_v1_monitoring_points_get",
"security": [
{
"OAuth2PasswordBearer": []
}
],
"parameters": [
{
"name": "X-Project-Id",
"in": "header",
"required": false,
"schema": {
"anyOf": [
{
"type": "string",
"format": "uuid"
},
{
"type": "null"
}
],
"title": "X-Project-Id"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/MonitoringPointOut"
},
"title": "Response Points Api V1 Monitoring Points Get"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/api/v1/monitoring/readings/query": {
"post": {
"tags": [
"monitoring"
],
"summary": "Readings",
"operationId": "readings_api_v1_monitoring_readings_query_post",
"security": [
{
"OAuth2PasswordBearer": []
}
],
"parameters": [
{
"name": "X-Project-Id",
"in": "header",
"required": false,
"schema": {
"anyOf": [
{
"type": "string",
"format": "uuid"
},
{
"type": "null"
}
],
"title": "X-Project-Id"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ReadingQuery"
}
}
}
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ReadingQueryResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/api/v1/analyses": {
"post": {
"tags": [
"analyses"
],
"summary": "Create",
"operationId": "create_api_v1_analyses_post",
"security": [
{
"OAuth2PasswordBearer": []
}
],
"parameters": [
{
"name": "Idempotency-Key",
"in": "header",
"required": false,
"schema": {
"anyOf": [
{
"type": "string",
"maxLength": 255
},
{
"type": "null"
}
],
"title": "Idempotency-Key"
}
},
{
"name": "X-Project-Id",
"in": "header",
"required": false,
"schema": {
"anyOf": [
{
"type": "string",
"format": "uuid"
},
{
"type": "null"
}
],
"title": "X-Project-Id"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AnalysisCreate"
}
}
}
},
"responses": {
"202": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/JobOut"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/api/v1/analyses/{job_id}": {
"get": {
"tags": [
"analyses"
],
"summary": "Get",
"operationId": "get_api_v1_analyses__job_id__get",
"security": [
{
"OAuth2PasswordBearer": []
}
],
"parameters": [
{
"name": "job_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid",
"title": "Job Id"
}
},
{
"name": "X-Project-Id",
"in": "header",
"required": false,
"schema": {
"anyOf": [
{
"type": "string",
"format": "uuid"
},
{
"type": "null"
}
],
"title": "X-Project-Id"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/JobOut"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/api/v1/analyses/{job_id}/cancel": {
"post": {
"tags": [
"analyses"
],
"summary": "Cancel",
"operationId": "cancel_api_v1_analyses__job_id__cancel_post",
"security": [
{
"OAuth2PasswordBearer": []
}
],
"parameters": [
{
"name": "job_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid",
"title": "Job Id"
}
},
{
"name": "X-Project-Id",
"in": "header",
"required": false,
"schema": {
"anyOf": [
{
"type": "string",
"format": "uuid"
},
{
"type": "null"
}
],
"title": "X-Project-Id"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/JobOut"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/api/v1/simulation/models": {
"post": {
"tags": [
"simulations"
],
"summary": "Upload",
"operationId": "upload_api_v1_simulation_models_post",
"security": [
{
"OAuth2PasswordBearer": []
}
],
"parameters": [
{
"name": "X-Project-Id",
"in": "header",
"required": false,
"schema": {
"anyOf": [
{
"type": "string",
"format": "uuid"
},
{
"type": "null"
}
],
"title": "X-Project-Id"
}
}
],
"requestBody": {
"required": true,
"content": {
"multipart/form-data": {
"schema": {
"$ref": "#/components/schemas/Body_upload_api_v1_simulation_models_post"
}
}
}
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ModelUploadOut"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/api/v1/simulations": {
"post": {
"tags": [
"simulations"
],
"summary": "Create",
"operationId": "create_api_v1_simulations_post",
"security": [
{
"OAuth2PasswordBearer": []
}
],
"parameters": [
{
"name": "Idempotency-Key",
"in": "header",
"required": false,
"schema": {
"anyOf": [
{
"type": "string",
"maxLength": 255
},
{
"type": "null"
}
],
"title": "Idempotency-Key"
}
},
{
"name": "X-Project-Id",
"in": "header",
"required": false,
"schema": {
"anyOf": [
{
"type": "string",
"format": "uuid"
},
{
"type": "null"
}
],
"title": "X-Project-Id"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SimulationCreate"
}
}
}
},
"responses": {
"202": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/JobOut"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/api/v1/simulations/{job_id}": {
"get": {
"tags": [
"simulations"
],
"summary": "Get",
"operationId": "get_api_v1_simulations__job_id__get",
"security": [
{
"OAuth2PasswordBearer": []
}
],
"parameters": [
{
"name": "job_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid",
"title": "Job Id"
}
},
{
"name": "X-Project-Id",
"in": "header",
"required": false,
"schema": {
"anyOf": [
{
"type": "string",
"format": "uuid"
},
{
"type": "null"
}
],
"title": "X-Project-Id"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/JobOut"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/api/v1/jobs/{job_id}/events": {
"get": {
"tags": [
"jobs"
],
"summary": "Events",
"operationId": "events_api_v1_jobs__job_id__events_get",
"security": [
{
"OAuth2PasswordBearer": []
}
],
"parameters": [
{
"name": "job_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid",
"title": "Job Id"
}
},
{
"name": "X-Project-Id",
"in": "header",
"required": false,
"schema": {
"anyOf": [
{
"type": "string",
"format": "uuid"
},
{
"type": "null"
}
],
"title": "X-Project-Id"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/api/v1/tianditu/geocode": {
"post": {
"tags": [
"tianditu"
],
"summary": "Geocode",
"operationId": "geocode_api_v1_tianditu_geocode_post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TiandituGeocodeRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TiandituGeocodeResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
},
"security": [
{
"OAuth2PasswordBearer": []
}
]
}
},
"/health/live": {
"get": {
"summary": "Live",
"operationId": "live_health_live_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"additionalProperties": {
"type": "string"
},
"type": "object",
"title": "Response Live Health Live Get"
}
}
}
}
}
}
},
"/health/ready": {
"get": {
"summary": "Ready",
"operationId": "ready_health_ready_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"additionalProperties": {
"type": "string"
},
"type": "object",
"title": "Response Ready Health Ready Get"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"AnalysisCreate": {
"properties": {
"algorithm": {
"type": "string",
"const": "data-quality",
"title": "Algorithm"
},
"device_ids": {
"items": {
"type": "string",
"format": "uuid"
},
"type": "array",
"maxItems": 100,
"minItems": 1,
"title": "Device Ids"
},
"observed_from": {
"type": "string",
"format": "date-time",
"title": "Observed From"
},
"observed_to": {
"type": "string",
"format": "date-time",
"title": "Observed To"
}
},
"type": "object",
"required": [
"algorithm",
"device_ids",
"observed_from",
"observed_to"
],
"title": "AnalysisCreate"
},
"Body_upload_api_v1_simulation_models_post": {
"properties": {
"name": {
"type": "string",
"maxLength": 200,
"minLength": 1,
"title": "Name"
},
"file": {
"type": "string",
"contentMediaType": "application/octet-stream",
"title": "File"
}
},
"type": "object",
"required": [
"name",
"file"
],
"title": "Body_upload_api_v1_simulation_models_post"
},
"DatabaseHealthResponse": {
"properties": {
"postgres": {
"type": "string",
"title": "Postgres"
},
"timescale": {
"type": "string",
"title": "Timescale"
}
},
"type": "object",
"required": [
"postgres",
"timescale"
],
"title": "DatabaseHealthResponse"
},
"DeviceOut": {
"properties": {
"id": {
"type": "string",
"format": "uuid",
"title": "Id"
},
"monitoring_point_id": {
"type": "string",
"format": "uuid",
"title": "Monitoring Point Id"
},
"external_id": {
"type": "string",
"title": "External Id"
},
"active": {
"type": "boolean",
"title": "Active"
}
},
"type": "object",
"required": [
"id",
"monitoring_point_id",
"external_id",
"active"
],
"title": "DeviceOut"
},
"HTTPValidationError": {
"properties": {
"detail": {
"items": {
"$ref": "#/components/schemas/ValidationError"
},
"type": "array",
"title": "Detail"
}
},
"type": "object",
"title": "HTTPValidationError"
},
"JobOut": {
"properties": {
"id": {
"type": "string",
"format": "uuid",
"title": "Id"
},
"status": {
"type": "string",
"title": "Status"
},
"progress": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
],
"title": "Progress"
},
"result": {
"anyOf": [
{
"additionalProperties": true,
"type": "object"
},
{
"type": "null"
}
],
"title": "Result"
},
"error": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Error"
}
},
"type": "object",
"required": [
"id",
"status"
],
"title": "JobOut"
},
"MapExtent": {
"properties": {
"xmin": {
"type": "number",
"title": "Xmin"
},
"ymin": {
"type": "number",
"title": "Ymin"
},
"xmax": {
"type": "number",
"title": "Xmax"
},
"ymax": {
"type": "number",
"title": "Ymax"
}
},
"type": "object",
"required": [
"xmin",
"ymin",
"xmax",
"ymax"
],
"title": "MapExtent"
},
"ModelUploadOut": {
"properties": {
"model_id": {
"type": "string",
"format": "uuid",
"title": "Model Id"
},
"model_version_id": {
"type": "string",
"format": "uuid",
"title": "Model Version Id"
},
"version": {
"type": "integer",
"title": "Version"
},
"sha256": {
"type": "string",
"title": "Sha256"
}
},
"type": "object",
"required": [
"model_id",
"model_version_id",
"version",
"sha256"
],
"title": "ModelUploadOut"
},
"MonitoringPointOut": {
"properties": {
"id": {
"type": "string",
"format": "uuid",
"title": "Id"
},
"external_id": {
"type": "string",
"title": "External Id"
},
"name": {
"type": "string",
"title": "Name"
}
},
"type": "object",
"required": [
"id",
"external_id",
"name"
],
"title": "MonitoringPointOut"
},
"ProjectMetaResponse": {
"properties": {
"project_id": {
"type": "string",
"format": "uuid",
"title": "Project Id"
},
"code": {
"type": "string",
"title": "Code"
},
"name": {
"type": "string",
"title": "Name"
},
"description": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Description"
},
"status": {
"type": "string",
"enum": [
"active",
"inactive"
],
"title": "Status"
},
"project_role": {
"type": "string",
"title": "Project Role"
},
"gs_workspace": {
"type": "string",
"title": "Gs Workspace"
},
"map_extent": {
"anyOf": [
{
"$ref": "#/components/schemas/MapExtent"
},
{
"type": "null"
}
]
}
},
"type": "object",
"required": [
"project_id",
"code",
"name",
"description",
"status",
"project_role",
"gs_workspace",
"map_extent"
],
"title": "ProjectMetaResponse"
},
"ProjectSummaryResponse": {
"properties": {
"project_id": {
"type": "string",
"format": "uuid",
"title": "Project Id"
},
"code": {
"type": "string",
"title": "Code"
},
"name": {
"type": "string",
"title": "Name"
},
"description": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Description"
},
"status": {
"type": "string",
"enum": [
"active",
"inactive"
],
"title": "Status"
},
"project_role": {
"type": "string",
"title": "Project Role"
}
},
"type": "object",
"required": [
"project_id",
"code",
"name",
"description",
"status",
"project_role"
],
"title": "ProjectSummaryResponse"
},
"ReadingQuery": {
"properties": {
"device_ids": {
"items": {
"type": "string",
"format": "uuid"
},
"type": "array",
"maxItems": 100,
"minItems": 1,
"title": "Device Ids"
},
"observed_from": {
"type": "string",
"format": "date-time",
"title": "Observed From"
},
"observed_to": {
"type": "string",
"format": "date-time",
"title": "Observed To"
},
"granularity": {
"type": "string",
"enum": [
"5m",
"1h",
"1d"
],
"title": "Granularity",
"default": "5m"
},
"metrics": {
"items": {
"type": "string"
},
"type": "array",
"maxItems": 6,
"minItems": 1,
"title": "Metrics"
}
},
"type": "object",
"required": [
"device_ids",
"observed_from",
"observed_to",
"metrics"
],
"title": "ReadingQuery"
},
"ReadingQueryResponse": {
"properties": {
"data": {
"items": {
"$ref": "#/components/schemas/ReadingRow"
},
"type": "array",
"title": "Data"
},
"meta": {
"additionalProperties": true,
"type": "object",
"title": "Meta"
}
},
"type": "object",
"required": [
"data",
"meta"
],
"title": "ReadingQueryResponse"
},
"ReadingRow": {
"properties": {
"device_id": {
"type": "string",
"format": "uuid",
"title": "Device Id"
},
"observed_at": {
"type": "string",
"format": "date-time",
"title": "Observed At"
},
"values": {
"additionalProperties": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
]
},
"type": "object",
"title": "Values"
}
},
"type": "object",
"required": [
"device_id",
"observed_at",
"values"
],
"title": "ReadingRow"
},
"SimulationCreate": {
"properties": {
"model_version_id": {
"type": "string",
"format": "uuid",
"title": "Model Version Id"
},
"parameters": {
"additionalProperties": true,
"type": "object",
"title": "Parameters"
}
},
"type": "object",
"required": [
"model_version_id"
],
"title": "SimulationCreate"
},
"TiandituGeocodeLocation": {
"properties": {
"lon": {
"type": "number",
"title": "Lon"
},
"lat": {
"type": "number",
"title": "Lat"
},
"level": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Level"
},
"score": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Score"
},
"keyWord": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Keyword"
}
},
"type": "object",
"required": [
"lon",
"lat"
],
"title": "TiandituGeocodeLocation"
},
"TiandituGeocodeRequest": {
"properties": {
"keyword": {
"type": "string",
"maxLength": 200,
"minLength": 1,
"title": "Keyword"
}
},
"type": "object",
"required": [
"keyword"
],
"title": "TiandituGeocodeRequest"
},
"TiandituGeocodeResponse": {
"properties": {
"status": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer"
}
],
"title": "Status"
},
"msg": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Msg"
},
"location": {
"anyOf": [
{
"$ref": "#/components/schemas/TiandituGeocodeLocation"
},
{
"type": "null"
}
]
},
"searchVersion": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Searchversion"
}
},
"type": "object",
"required": [
"status"
],
"title": "TiandituGeocodeResponse"
},
"ValidationError": {
"properties": {
"loc": {
"items": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer"
}
]
},
"type": "array",
"title": "Location"
},
"msg": {
"type": "string",
"title": "Message"
},
"type": {
"type": "string",
"title": "Error Type"
},
"input": {
"title": "Input"
},
"ctx": {
"type": "object",
"title": "Context"
}
},
"type": "object",
"required": [
"loc",
"msg",
"type"
],
"title": "ValidationError"
}
},
"securitySchemes": {
"OAuth2PasswordBearer": {
"type": "oauth2",
"flows": {
"password": {
"scopes": {},
"tokenUrl": "unused"
}
}
}
}
}
}