Use Case of API Gateway - shephertz/App42_APIGateway_Docs GitHub Wiki
Use case - Create API , Apply Authentication and Test API and View Specs:
Here is a simple use case which defines how you can create your API with proxy type and Apply Key based Authentication and how you can test your API with Generated SDK. You can also test your API on the go with Test Specs and view section.
Steps:
- Go to APIs -> Manage and create an API of Proxy type.
- Enter the mandatory fields and provide the endpoint for the API .
- Click on Submit.
- GO to Policies -> Authentication and select Authentication Type as KEY and click on submit.
- GO to API - > Settings , select your API , enable Authentication and Select Authentication Policy which you have created in step 4
- Go to IAMs -> Manage , create your IAMs
- Go to IAMs -> API Mapping , click on MAP API to attach your API with the IAM and click on submit.
The above steps will create your API , attach authentication policy and will map your API with the IAM.
Now to Test your API and authentication on API , you can do it either with SDK or with the Test API Section.
Test Specs and View Specs Section:
-
Go to Test Specs and View Specs Section: Choose your API. You can see the specs of your API with all the methods.
-
Select Your API method which you want to hit.
-
Provide the API Key (API Key is your IAM Key)
-
Click on Try it out and you can see the response of the API.
Similarly you can Test your API with the Generated SDK.
Generate Code Section:
- Click on Generate Code.
- Select your API and Platform(In this case lets select Java) on which you want to generate SDK.
- Click on Generate and it will download the SDK for your API configuration with all the details .
- Unzip the java SDK. search for the io.swagger.client.api package , here you will find the class with your API name .
- Open the file and here you can see the different method definitions to call your API(). This file will have methods with all the allowed methods and authentication parameters which you have configured for your API.