Access to the API is restricted by HTTP Basic Authentication. You need to add a user to your instance with the REST role attached to it. Use the username and password of the REST user as credentials for your HTTP requests.
The SORMAS REST API is documented automatically. The OpenAPI specification files are generated during the build process
and can be found at ${Project Root}/sormas-rest/target/swagger.{json,yaml}
.
You can render the OpenAPI specification with tools like editor.swagger.io. This allows you to inspect endpoints and example payloads, generate a matching API client for many languages, and to easily interact with the API of a live instance.
The OpenAPI files are generated with the swagger-maven-plugin
and the Swagger Annotation Framework[1].
If you are only interested in the OpenAPI specification files, you may either download a recent SORMAS
release where the files reside in the openapi
directory, or execute the following command inside the sormas-base
module's directory to build them for yourself:
# Requires Maven to be installed!
mvn package --projects ../sormas-rest --also-make -Dmaven.test.skip=true
The specification files are created at the path specified above.
[1] Swagger Annotations Guide on Github: https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Annotations