Creating REST APIs with Swagger
To create a REST API using a Swagger file
1. From the Integration Cloud navigation bar, click Projects > <Select a Project> > APIs > REST APIs.
The REST APIs page appears.
2. From the REST APIs page, click Add New REST API, select Build with Swagger, and then click OK.
In the New REST API page, complete the following fields. Required fields are marked with an asterisk on the screen.
Select... | To... |
Save As | Type a name for the REST API using any combination of letters, numbers, and/or the underscore character. |
Swagger Source | Select URL and enter the URL for the Swagger document. The URL should begin with https://. OR Select File and click Browse to select a Swagger document on your local file system. Swagger documents must be in either JSON format with a .json file extension or YAML format with a .yaml or .yml file extension. |
Click Save.
Note the following points after you click Save:
The REST API is created based on the Swagger definition that is uploaded or the Swagger definition that is referred to by the given URL.
Integrations are generated based on the Operation IDs in the Swagger file. One Integration is created for each Operation ID in the Swagger file. A Swagger file cannot have two Operation IDs that are similar.
Resource Operations are created for a unique path in the Swagger file.
3. To view the Swagger definition, from the REST APIs page, click the REST API link. The Overview page provides general information on the REST API. The Resources page allows you to view the resource operations. The Swagger page allows you to view the Swagger definition.
You can use Access Control Lists (ACLs) to control the execution permission of a REST API. Integration Cloud associates the default ACL, Default, to a REST API when the REST API is created using a Swagger file. Click Permissions to associate the REST API with another ACL.
Note:
The ACL will be enforced only if an Integration acts as a top-level Integration. For example, if Integration A has Integration B and Integration C as sub-Integrations, then the ACL if associated, will be enforced only on Integration A.
4. To edit the Integration, go to the Resources page, select a Resource Operation, expand its path, and click on the integration link. The Integration will be open for editing in the Edit Integrations page. Add necessary blocks and perform mappings.
Note:
You will not be able to modify the Input/Output signature of the Integration because the signature is derived from the Swagger definition.
5. To run the Integration with the given path and method, go to the Swagger page for the REST API, click Authorize and type your Integration Cloud user name and password to authorize access to your APIs, and then click Try it out.