Developing APIs on API Connect - 102 - Adding Parameters
Part of Two of the API Development on API Connect Series. In this part we will show how to specify parameters for an API call. This builds on from the artefact and knowledge created in part 1.
-
Go to the API that was created in part 1.
-
Go to the Design View
-
Click on Paths
-
Click on
/
-
Click on GET
-
Fill in the parameters
Summary - Operations Returns the account balance for a given Account ID
Tags - balance
Description - To consume this API you must pass on the account id -
Click on Add Parameters
-
Fill in the parameters Name - uid Located In - query Type - String Description - The Account ID to be queried
-
Press Save
-
Click on Properties
-
Click on the Hot Dog Menu next to target url and select edit
-
The query parameter must be removed and replaced with the variable we defined in the parameter in step 7. Change default value to
http://apic-test-app.eu-gb.mybluemix.net/api/balance?id={uid}
-
Press Save
-
Republish and test the API as we detailed in part 1.. If you are using the API Designer ensure you add the paremeter
?uid=1001
or?uid=1002
at the end of the url you are invoking. If you are using the API Manager you will need specify the parameter in the test form.