Skip to content

Instantly share code, notes, and snippets.

@mdouchin
Last active July 7, 2020 12:02
Show Gist options
  • Save mdouchin/5d7b8431188e0d1b52e6cc08c2692037 to your computer and use it in GitHub Desktop.
Save mdouchin/5d7b8431188e0d1b52e6cc08c2692037 to your computer and use it in GitHub Desktop.
G-Obs OpenAPI
{
"openapi": "3.0.1",
"info": {
"title": "G-Obs API",
"description": "G-obs API as OpenAPI Rest API",
"termsOfService": "",
"contact": {
"email": "[email protected]"
},
"license": {
"name": "Mozilla Public Licence 2.0",
"url": "https://www.mozilla.org/en-US/MPL/2.0/"
},
"version": "1.0.0"
},
"externalDocs": {
"description": "Find out more about G-Obs",
"url": "https://3liz.github.io/qgis-gobs-plugin/"
},
"servers": [
{
"url": "https://gobs.3liz.com/1.0.0"
}
],
"tags": [
{
"name": "project",
"description": "Project"
},
{
"name": "indicator",
"description": "Indicator"
},
{
"name": "observation",
"description": "Field observation"
},
{
"name": "user",
"description": "Operations about user"
}
],
"paths": {
"/observation": {
"put": {
"tags": [
"observation"
],
"summary": "Update an existing observation",
"operationId": "updateObservation",
"requestBody": {
"description": "Observation object that needs to be added to G-obs",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Observation"
}
}
},
"required": true
},
"responses": {
"400": {
"description": "Invalid ID supplied",
"content": {}
},
"404": {
"description": "Observation not found",
"content": {}
},
"405": {
"description": "Validation exception",
"content": {}
}
},
"x-codegen-request-body-name": "body"
},
"post": {
"tags": [
"observation"
],
"summary": "Add a new observation to G-Obs",
"operationId": "addObservation",
"requestBody": {
"description": "Observation object that needs to be added to G-Obs",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Observation"
}
}
},
"required": true
},
"responses": {
"405": {
"description": "Invalid input",
"content": {}
}
},
"x-codegen-request-body-name": "body"
}
},
"/observation/{observationId}": {
"get": {
"tags": [
"observation"
],
"summary": "Find observation by ID",
"description": "Returns a single observation",
"operationId": "getObservationById",
"parameters": [
{
"name": "observationId",
"in": "path",
"description": "ID of observation to return",
"required": true,
"schema": {
"type": "integer",
"format": "int64"
}
}
],
"responses": {
"200": {
"description": "successful operation",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Observation"
}
}
}
},
"400": {
"description": "Invalid ID supplied",
"content": {}
},
"404": {
"description": "Observation not found",
"content": {}
}
}
},
"post": {
"tags": [
"observation"
],
"summary": "Updates a observation in the store with form data",
"operationId": "updateObservationWithForm",
"parameters": [
{
"name": "observationId",
"in": "path",
"description": "ID of observation that needs to be updated",
"required": true,
"schema": {
"type": "integer",
"format": "int64"
}
}
],
"requestBody": {
"content": {
"application/x-www-form-urlencoded": {
"schema": {
"properties": {
"name": {
"type": "string",
"description": "Updated name of the observation"
},
"status": {
"type": "string",
"description": "Updated status of the observation"
}
}
}
}
}
},
"responses": {
"405": {
"description": "Invalid input",
"content": {}
}
}
},
"delete": {
"tags": [
"observation"
],
"summary": "Deletes an observation",
"operationId": "deleteObservation",
"parameters": [
{
"name": "api_key",
"in": "header",
"schema": {
"type": "string"
}
},
{
"name": "observationId",
"in": "path",
"description": "Observation id to delete",
"required": true,
"schema": {
"type": "integer",
"format": "int64"
}
}
],
"responses": {
"400": {
"description": "Invalid ID supplied",
"content": {}
},
"404": {
"description": "Observation not found",
"content": {}
}
}
}
},
"/observation/{observationId}/uploadPhoto": {
"post": {
"tags": [
"observation"
],
"summary": "uploads an image",
"operationId": "uploadFile",
"parameters": [
{
"name": "observationId",
"in": "path",
"description": "ID of observation to update",
"required": true,
"schema": {
"type": "integer",
"format": "int64"
}
}
],
"requestBody": {
"content": {
"multipart/form-data": {
"schema": {
"properties": {
"additionalMetadata": {
"type": "string",
"description": "Additional data to pass to server"
},
"file": {
"type": "string",
"description": "file to upload",
"format": "binary"
}
}
}
}
}
},
"responses": {
"200": {
"description": "successful operation",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiResponse"
}
}
}
}
}
}
},
"/observation/findByIndicator": {
"get": {
"tags": [
"observation"
],
"summary": "Finds observations by indicator",
"description": "Indicator id must be passed.",
"operationId": "findObservationByIndicator",
"parameters": [
{
"name": "id_indicator",
"in": "query",
"description": "Indicator ID to filter by",
"required": true,
"schema": {
"type": "integer",
"format": "int64"
}
}
],
"responses": {
"200": {
"description": "successful operation",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Observation"
}
}
}
}
},
"400": {
"description": "Invalid indicator value",
"content": {}
}
}
}
},
"/user/login": {
"get": {
"tags": [
"user"
],
"summary": "Logs user into the system",
"operationId": "loginUser",
"parameters": [
{
"name": "username",
"in": "query",
"description": "The user name for login",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "password",
"in": "query",
"description": "The password for login in clear text",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "successful operation",
"headers": {
"X-Rate-Limit": {
"description": "calls per hour allowed by the user",
"schema": {
"type": "integer",
"format": "int32"
}
},
"X-Expires-After": {
"description": "date in UTC when token expires",
"schema": {
"type": "string",
"format": "date-time"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "string"
}
},
"application/xml": {
"schema": {
"type": "string"
}
}
}
},
"400": {
"description": "Invalid username/password supplied",
"content": {}
}
}
}
},
"/user/logout": {
"get": {
"tags": [
"user"
],
"summary": "Logs out current logged in user session",
"operationId": "logoutUser",
"responses": {
"default": {
"description": "successful operation",
"content": {}
}
}
}
}
},
"components": {
"schemas": {
"ApiResponse": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"type": {
"type": "string"
},
"message": {
"type": "string"
}
}
},
"Value": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "name of the vector dimension"
},
"type": {
"type": "string",
"description": "Format of the value",
"enum": [
"integer",
"string",
"boolean",
"real"
]
},
"value": {
"type": "string"
}
},
"xml": {
"name": "Tag"
}
},
"Observation": {
"required": [
"timestamp",
"values",
"x",
"y"
],
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"timestamp": {
"type": "string",
"description": "Date and time of the observation"
},
"x": {
"type": "number",
"description": "Longitude of the observation"
},
"y": {
"type": "number",
"description": "Latitude of the observation"
},
"values": {
"type": "array",
"xml": {
"wrapped": true
},
"items": {
"$ref": "#/components/schemas/Value"
}
},
"photo": {
"type": "string"
}
},
"xml": {
"name": "Observation"
}
},
"User": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"username": {
"type": "string"
},
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"email": {
"type": "string"
},
"password": {
"type": "string"
},
"phone": {
"type": "string"
},
"userStatus": {
"type": "integer",
"description": "User Status",
"format": "int32"
}
},
"xml": {
"name": "User"
}
}
},
"securitySchemes": {
"BasicAuth": {
"type": "http",
"scheme": "basic"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment