How to use a SWAGGER file hosted online in a REST Service Instance
KBF200032
PRODUCT
K2 Cloud environments require that the SWAGGER file for REST Service Instances are hosted online to be able to be accessed by the Cloud environment.
For the Cloud environment to be able to read the SWAGGER file successfully, the URL must point to a JSON page with no extras from the hosting website. If the SWAGGER file is hosted on a site such as GitHub, you may run into the following error when using the generic link to the file:
VALIDATIONBroker requires a Swagger 2.x descriptor '[HTTPS://SWAGGERfileLocation]'
To resolve this error, you will need to provide the REST service instance with a file location that just provides the "raw" JSON, with no extra CSS, images, or layout of the hosting site. In the example of GitHub, you will want to use the "Raw" button which will load the JSON directly into a browser page, which will turn the URL from
https://github.com/Folder/Swagger/blob/master/Swagger.json
into the following:
https://raw.githubusercontent.com/Folder/Swagger/master/Swagger.json
Using this URL in the REST Service Instance will allow K2 to parse through the file successfully, allowing the creation and use of the REST Service instance.