Add URL parameters in API operations
In this topic, you learn how to add URL parameters in an API operation of an external API. API operations are defined for an API in the API Designer.
| In this task, you perform the minimum steps to add URL parameters. For more information on how to add operations, see Add an operation. |
Prerequisites
-
You have configured an external API.
Procedure
-
In the Cockpit, go to Connectivity and select API Designer.
-
From the table, select the external API that you want to add URL parameters to.
-
In the Operations tab, select + to add an operation.
-
In Path, enter a slash and the name of an end path for the external API, then add another slash and the parameter in parentheses, for example,
/planets/(planetId). -
In Method, select a method from the list, for example
GET. -
Go to the Request tab.
-
In the Parameters section, select + to define a parameter.
-
In Name, enter the parameter you added in the path, for example,
planetId. -
Activate In Path.
When this operation is executed, the value will replace the parameter in the URL. For example, if the operation /planets/(planetId)is executed with the value1, the request will be/planets/1. -
Ensure to document API parameters and request body fields by entering values into the Documentation dialog by selecting the information icon.
When defining parameters or request body fields in the API Designer, provide all key documentation fields to ensure clarity for developers. Ensure to appropriately fill the Description parameter as AI tools used for API execution source this information.
Fields to complete:
-
Value Alternatives (
enum): Specifies a fixed set of allow values for a property or parameter.Example:
[MERC, VEN, EAR, MAR] -
Pattern (regex string): Defines a regular expression that a string property must match.
Example:
'^[A-Z]{3}$'(Must be 3 uppercase letters) -
Description: Explain the purpose of the parameter in context.
Example:
The unique 3-letter code identifying a planet in the solar system. -
Example: Provide a valid value that satisfies both the allowed values and the pattern.
Example:
"EAR"
-
-
Select Save.