webMethods API Gateway tutorial
In Integration cloud, integrations can be built to accomplish particular tasks, suppose one has to invoke custom APIs created in API gateway as part of the integration; it can be accomplished through REST applications of the Integration cloud.
Below section details a way to invoke API gateway APIs as part of integrations [Note: Integration cloud and API gateway are accessed in Software AG cloud
Prerequisites
1. Create a tenant in Software AG Cloud and subscribe for Integration cloud and API gate way
- Tenant: “TestTenant”
Create API in API gateway
1. Login to Software AG cloud as “TestTenant.
2. Open “API Gateway” > Click “APIs” tab > Click “Create API” button.
3. Select “Import API from URL” [Using “Swagger Petstore” URL as example, which can be found at: https://petstore.swagger.io/ ], provide following values for the attributes
- URL: “https://petstore.swagger.io/v2/swagger.json“
- Name: “PetStoreAPI”
- Type: “Type”
- Version: “1”
Click “Create”, a page will open as shown below,
Click “Activate” > Click “Yes” in conformation dialogue
Create REST application in Integration Cloud
1. Login to Software AG cloud as “TestTenant.
2. Open “Integration Cloud” > Click “Connect” tab, Click “REST Applications” > Click “Add New Application”, provide below values for the attributes
- Name: “TestRestApp”
- Default Endpoint URL: “http://<tenantName>.gateway.webmcloud.com/gateway/PetStoreAPI/1” [This URL can be found at APIs “Technical information” section in API Gateway]
- Authentication Type: “Credentials”
Click “Next”
3. Click “Add Resource”, provide below values for attributes,
- Name: “getInventory”
- Path: “/store/inventory” [it can be found at APIs “Resources and methods” section in API Gateway]
Click “Add”
4. Click “getInventory” > Click “Add Action” , provide below values for attributes
- Method: “GET”
Under “Request” > “Headers”, add below headers
- Accept: application/json
- Content-Type: application/json
Under “Response” > “Headers”, add below headers
- Accept: application/json
- Content-Type: application/json
Under “Response” > “Body” > Click “Add Response Body” with below values
- HTTP Code: 200
- Content Type: application/json
- Document Type: Click “Create document” and all the attributes that are needed in response body of the rest call [Used empty document in the example]
Click “Add”
Click “Add” for resource > Click “Next” > Click “Finish”
5. Click “TestRestApp” > Click “Add New Account” and provide below values for attribute
- Save as: “APIGateway_Account”
- Server URL: “http://<tenantName>.gateway.webmcloud.com/gateway/PetStoreAPI/1”
Click “Save”
6. Click “Operations” tab, Click “Add New Operation”
- Save as: “Operation”
- Select “APIGateway_Account” for Account, Click “Next”
- Select “getgetInventory” for operation, Click “Next”
Click “Next” > Click “Next” > Click “Finish”
Select “Operation” and Click “Test” to test the working of the created operation, under provided empty document in response body, all the pet inventory results will be shown
7. In the Integration Cloud Click “Develop” > Click “Add New Integration” > Select “Orchestrate two or more applications” > Click “Applications” in navigation panel and search for the created REST application “TestRestApp”. Now created application can be used as part of the Integrations