Interfaces - Gepardec/Hogarama GitHub Wiki

REST-Service

Implementation

Swagger

Swagger and its maven-plugin swagger-codegen-maven-plugin are used to generate the interface for the REST-service. Under <configOptions>, the configuration for the codegeneration can be specified, eg package name. Files and directories listed in /ignore.txt, will not be generated by swagger-codegen. The generated files can be found under target/generated-sources/swagger. target/genearted-sources/swagger/main is used as a source directory in order to provide the files.

The Swagger definition can be found in hogajama.swagger.yaml

Hints and Remarks for Swagger

Using the plugin was a little tricky since the plugin creates more classes than needed, e.g templates for the implementation. In order to fix this we had to configure a special ignore-file. The plugin also seems not to add the generated classes directory to the source directory unless the configuration points to the right directory. Therefore be careful with the configuration. See pom.xml in REST-project for the configuration.

Usage

Sensor Data is stored in MongoDB. The following data can be retrieved over REST services:

Sensor names:

https://app-hogarama.apps.p.aws.ocp.gepardec.com/hogajama-rs/rest/sensor/

Sensor data:

https://app-hogarama.apps.p.aws.ocp.gepardec.com/hogajama-rs/rest/sensor/allData

Resultset can be limited by

  • maximum number of data points: add ?maxNumber=yourNumber
  • sensor name: add ?sensor=yourSensorName
  • from: add ?from=startDateAndTime
  • to: add ?to=endDateAndTime
  • concatenate several constraints with &

For example: