Add Server Variables for Service Connections
After creating a service connection, you can go to the Servers tab and edit the server's instance URL and add server variables.
Note:
For service connections created after the 23.10 release, server variables must be updated from the backend associated with the service connection. For more information, see Add Server Variables for Backends.When you enter a valid URI template expression, such as
{version}
, in an instance URL, a server variable will be
created automatically and displayed in the Server editor's Server
Variables section. You can also create, edit, or reorder a list of
variables. A default value must be set for each server variable.
https://restcountries.com/v3.1/lang/german
as an example:
- The server instance URL can be represented as
https://restcountries.com/{version}/lang
.Here, there's just one server variable,
{version}
, which has a default value of v3.1, as shown:
Description of the illustration server-variable-example.png - The endpoint is
/{language}
.Here,
language
is a path parameter, because it's a part of the endpoint path. It can't be a server variable, in this example, because it's outside the instance URL. Its default value is german and its type is string. - The full URL becomes
https://restcountries.com/{version}/lang/{language}
.After substitution (v3.1 for the server variable
{version}
and german for thelanguage
path parameter), this represents the instance URL we started with,https://restcountries.com/v3.1/lang/german
.
Tip:
There's a new Server Variables tab in the Endpoint editor's Test tab. You can use this tab to test the value of server variables when you're testing an endpoint. With a defined value list, you can effectively change the URL and test each version. The process for using this functionality is very similar to what was described here.