How to use Query Parameters in Service Suite?
Query Youparameters are values added to the URL after the ? character. They are commonly used to provide optional parameters or filters to an API request.
In Service Suite, you can construct thea URL of the endpointdynamically using javascriptJavaScript string concatenation expressions that can includeand variables.
Example
The following example inuses the following snippet, the variable $clientNumber is used in the query part of the URL of a GET call. Also addingas a query parameter “_”in toa useGET request. It also adds a timestamp as a cachecache-busting buster with the current epoch time number.parameter:
var $clientNumber = getLoggedClientNumber(); // or can beOr read the value from a CSV file
var $url = $server + “"/common/getClientData/?clientNumber=“" + $clientNumber +”?_” "&_=" +Date. Date.now();
var $response = get($url);
var $json = JSON.JSON.parse($response.getDataString());
var $clientNumber = $json.clientNumber;
How
If
$server contains:
https://example.com
and $clientNumber contains:
12345
the resulting URL will look similar to:
https://example.com/common/getClientData/?clientNumber=12345&_=1750000000000
The URL contains two query parameters:
clientNumber=12345— passes the client number to the API._=followed by the current epoch time — adds a unique value to help prevent the request from being served from a cached response.
Date.now() returns the current time in milliseconds since the Unix epoch.
Multiple Query Parameters
When an endpoint requires multiple query parameters, use ? before the first parameter and & before each additional parameter.
For example:
var $url = $server + "/common/getClientData/?clientNumber=" + $clientNumber + "&status=active";
This produces a URL such as:
https://example.com/common/getClientData/?clientNumber=12345&status=active
Query Parameters vs. Path Parameters
A path parameter is part of the URL path:
/customer/12345/reports
A query parameter is included after ?:
/customer/reports?clientNumber=12345
The API determines which format should be used for each endpoint.
Summary
Use JavaScript string concatenation to dynamically construct URLs containing query parameters:
var $url = $server + "/common/getClientData/?clientNumber=" + $clientNumber;
When adding more than one query parameter, separate them with &:
var $url = $server + "/common/getClientData/?clientNumber=" + $clientNumber + "&status=active";
Last updated: MarchAugust 21,1, 20232026
If you have any feedback on this topic, please contact us at documentation@appvance.ai.