There are two ways to pass parameters in the Gateway. In this example, food data is used as a data source and demonstrates how to retrieve a list of food items by Category parameter using both methods.
1. Request Parameters
The parameters are set within the URL. For example: /Names/Albert.
Create a path and select GET as the HTTP method. In the path name field, add a path name followed by the field we are querying within curly braces {} this will be a place holder which we will replace with a value when querying the API.
The category is the parameter as highlighted in the below image.
In the Definition tab, add the Security Schemes. In the Path Parameters section, the parameter name will automatically be added from the parameter path with whatever is specified in the curly braces as illustrated in the below page.
In the Source tab, select the Buffer source. In the Buffer Action field, Query will be used in this example. In the Query Builder, add the parameter to query for the category field. Select the field to query from the drop-down list (field on the left) and in the field on the right, type the parameter you are querying. eg. @reqParameters.FieldName
Save the API Path and test in Postman. The below image contains the results that are returned.
2. Query Parameters
These parameters are added to the URL. For example: /People?Name=Albert
Create a path and select GET as the HTTP method. In the path name field, add a path name as per the image below.
In the Definition tab, add the Security Schemes. In the Parameters section, add the parameter name, data type and select “Query” on In field as illustrated in the image below.
In the Source tab, choose a Flow source. The below image is an example of the flow we will be using. It contains a Parameter that will be used to query the buffer and return a response.
In the Flow Parameters section under the Source tab, select the From Path parameter as @reqQuery.Category
. In the To Parameter, select Category from the dropdown list as shown in the below image. Choose the return source as Record and Output Content Type as JSON Object.
Save the API Path and test in Postman. The page below is the returned results.