Path parameter
Last updated
Last updated
Path parameters are variables that appear within the URL that points toward a specific resource.
There can be multiple path parameters.
The Path parameter can be a constant text or a variable value added after the API group base URL.
In a constant path parameter, on calling the API, the representation text of the path parameter in the URL is consistent. It does not change on calling the API.
To define a constant path parameter, in the Details tab>API name or path parameters field:
Enter the parameter name
Press Enter. It displays in a blue bubble.
In the URL, the constant path parameter displays without curly brackets.
In a reference or variable path parameter, on calling the API, the representation text of the path parameter in the URL can vary depending on the data to query the API with. For example, the URL below has a variable path parameter “name,” where the API caller can put the customer's name in that variable path parameter and find out the rating of the customer.
To define a variable path parameter, in the Details tab>API name or path parameters field,
Click the [+] button.
To define the variable parameter:
Enter the parameter name.
Click the [Save] button.
The variable path parameter is displayed in a white bubble ( the “expression bubble”). In the URL, it is displayed with curly brackets.
After saving the parameter name, go to the Inputs & outputs tab>Path Parameters section. The created variable parameter is displayed with data type as “string”.
Users must add the sample for the parameter. (as not adding the path parameter will prevent the user from saving the API successfully)