Below sections details how service built in the integration cloud can be published in API portal which then can be used by end-user.
Prerequisites
1. Create tenant in SAG cloud, subscribe for Cumulocity, Integration cloud, API Gateway and API Portal
Integration cloud
1. Follow the steps to create new integration as in:
http://techcommunity.softwareag.com/pwiki/-/wiki/Main/Cumulocity+and+Integration+cloud+integration%3A+Add+device+in+cumulocity+using+Integration+cloud
This service adds device in cumulocity. Any other simple service can also be used.
2. Login to SoftwareAG Cloud <https://www.softwareag.cloud> using tenant details and open Integration Cloud.
3. Click “Develop” > click “Rest APIs” > click “Add New Rest API” > select “Build from scratch”. Provide following details
Save as: Name of the API [TestAPI]
Swagger Title: Swagger name [TestSwagger]
Version: API version [1]
Consumes/Produces: check “application/json” and “application/xml”
Click “Save”
4. Click “Resources” > click “Add New Resource” and provide following details
Path: rest API path [/testrest]
Mapped Integration: select [TestIntegration]
HTTP Methods: select [Post]
Click “Save and Continue” > Click “Save and Finish”
5. Click “Swagger” tab, > click “Authorize” provide username and password ( tenant mail and password) > click “Done”
6. Click “post/testrest” > click “Try it out”, in the json body provide “true” for “c8y_IsDevice”
Click “Execute”, Response code should be 200
Select “json” in “Download swagger” dropdown, a file will be downloaded [TestAPI.json].
API Gateway
1. Login to SoftwareAG Cloud <https://www.softwareag.cloud> using tenant details and open API Gateway.
2. Click “APIs” > click “Create API” > select “Import API from file” and provide following details
Select file: Browse file that has been downloaded in “Integration cloud: Step6 [TestAPI.json]
Name: Name for the API [APIGatewayTestAPI]
Type: select “Swagger”
Click “Create”
3. Click “Policies” tab > click “Edit” > select “Identify & Authorize Application” under “Identify & Access” > under “Identification Type” check “API Key” and Save
4. Click on “User Profile” Image > click “Administration” > click “Destinations” > click “API Portal” under “Gateway configuration” provide username and password (tenant credentials) > click “Publish
5. Click “APIs” tab > Activate [APIGatewayTestAPI] by sliding toggle switch > Publish API by clicking Publish button
API Portal
1. Login to SoftwareAG Cloud <https://www.softwareag.cloud> using tenant details and open API Portal.
2. Click “API Gallery” tab > published API [APIGatewayTestAPI] will be seen, click “View details” > click “Try API”, in the information message “This API requires authentication by [APIKey]. To obtain an access token, click here”, click “click here” link.
3. Provide Application name [TestToken] > click “Request Token” > click “Close” > Refresh the page, Token will be generated automatically
4. Under “Header parameters” > click “Security” > select “Basic Authentication” as Type and provide tenant credentials > click “Update”
Under “API method request” paste below json body
{
"c8y_IsDevice": true
}
Click “Test”, Device id and 200 response code will appear in the response
5. For cross verification, login to SoftwareAG Cloud < https://www.softwareag.cloud> using tenant details and open Cumulocity. Click “Device Management” > click “Devices” > click “All devices”
A device would have been added with a device id as below,