Generate Tab
The "Generate" tab is a custom version of a full version of SWAGGER Editor and SWAGGER UI combined.
The page is split into two sections- the editor and the UI section
The left hand window - Swagger editor enables editing of the SWAGGER specification directly, and the right-hand side - the Swagger UI shows the documentation and allows testing of the Provider / consumer once it is generated and completed.
Button bars
Left
Editor | The Swagger Editor is displayed on the full screen |
Split | The Swagger Editor and Swagger UI sections both are displayed |
UI | Only the Swagger UI is displayed on full screen |
Right
Create Program | Used to create the API |
Submit Object Request | To submit the Object request to the MDCMS, visible only if "Object required" under "MDCMS values" is set to true in the Configuration settings |
View Source | To display the generated code (Enabled only if the API is successfully generated). Brings up a dropdown list of all generated programs |
Publish / Documentation | To publish the API specification to MDRest4i Portal/Documenter or view the published document |
More | The dropdown menu same as in the General tab. |
Create Program
Select the required path and method and click the “Generate” button.
Upon completion of the code generation process on the IBM i, the following success message popup appears
Object Request Warning!
If MDCMS Force Object Request checked in Configuration settings, and an MDCMS Object Request has not been submitted prior to trying to Create Program, then the following warning will appear:
The Create Object Request Now button lets you both add/modify and submit the object request.
After successfully submitting an MDCMS Object Request, click the button again.
View Source
The dropdown button which lists all the generated members.
This option lets you view the generated RPG source. The user can select the program from the dropdown list.
Publish/ Documentation
Select this button to publish the API specification to the MDRest4i Portal/Documenter.
Figure 9: Publish to documenter
Select the Environment from the dropdown list and click
If an older version of the document is already published on the documenter, you get an error message
If we check the "Force Overwrite" checkbox, and select then the copy in MDRest4i Portal/Documenter is over-written.
Swagger Editor
The Swagger Editor allows you to define and document RESTful APIs using the Swagger Specification.
We created the Swagger definition using the MDREST4i-SDK-Console Web GUI. Any changes made using the editor would be reflected in the MDREST4i-SDK-Console Web GUI and vice-versa.
Swagger UI
Test the Generated Service
In the UI section on the right, scroll down until the server and “GET” button (or whichever method you have cerated) appears. Click on the “GET” Button to expand it.
Now scroll down to the “Parameters” section
Scroll down to the “Server response” section.
Figure 13: Parameters Section expanded
Enter the value of the parameters as necessary, and select the "execute" button. This sends a request to the generated Provider
Scroll down to the “Server response” section. The response body can be seen as JSON in this window.