The OpenAPI document is a JSON document and describes the API formal. Using such generic OpenAPI documents various REST clients can be created automatically e.g. JavaScript, Java or C #.
The following link can be used to access the OpenAPI document of the AMPAREX API:
https://<host>/amparex/webaxapi/v2/api-docs
or
http://<host>:8080/amparex/webaxapi/v2/api-docs
Depending on the server, <host> must be replaced by the server name (e.g. preview1). The result is a JSON document that has to be copied from the browser:
Access to the Open API document only works on test servers. |
The below JSON document is a description of AMPAREX API for SwaggerHub.
In order to visualize the API one needs the Swagger tool, 'Swagger-UI'. The following steps are necessary to set it up:
Description | ||
---|---|---|
01) Create an account under SwaggerHub 02) Log in to SwaggerHub 03) Create a new API | ||
04) Fill out the dialogue as shown on the right 05) Click ‘Create New API’ 06) The Swagger UI will open with the OpenAPI editor. The editor is on the left and the API documentation is on the right | ||
07) Now copy the previously copied OpenAPI JSON document from the URL 'http: //localhost: 8080/amparex/webaxapi/v2/api-docs' into the left editor window 08) Confirm the question whether to convert from JSON to XAML with 'Yes' | ||
09) The API documentation is now shown in the preview on the right. 10) This document is the API documentation. In the upper part you’ll find the individual access methods for the API. The lower part describes the ‘model’ which means the entities (e.g. article). | ||
11) There is a download button in the SwaggerHub header menu. It can be used to easily create a RestClient project in order to use the API more conveniently 12) There are many different languages to be found. In our example, a Java client is created | ||
13) The created zip file will be saved. 14) The project can be opened in a Java development environment. The best would be to create a JAR file from it. | ||
15) A 'Test Main Class' shows the use of the Rest Java client
|