Upload
ashok-kumar-palaki
View
99
Download
0
Embed Size (px)
Citation preview
Create an API with an Inline Script
Download the API Manager form here http://wso2.com/products/api-manager/
Log in to the API Publisher.
Select the option to design a new API and click Start Creating.
Give the information in the table below. To add resources, click the Add button
Fill the fields with following data.Name : City_NameContext : /locationVersion : 1.0.0
Resources URL pattern {town}Request types GET
Click on {twon}
Click on Next: Implement >
Select Prototype API in Implement phase
Select Inline option.
Expand the GET method.
Copy the following script in the Script area.
mc.setProperty('CONTENT_TYPE', 'application/json');var town = mc.getProperty('uri.var.town');mc.setPayloadJSON('{ "Town" : "'+town+'"}'); Click on Deploy as a Prototype
Select Go to API Store
Login in API Store as admin
Select Prototyped API
Then select your API (City_Name)
Select API Console optionExpand GET methodType the City Name (Any)Click on Try it out button.
This is the Final Response of your API