Skip to main content

How to use Path Parameters in Service Suite?

Path parameters are dynamic values that are included directly in the URL path of an API endpoint.

In Service Suite, you can construct an endpoint URL using JavaScript string concatenation. This allows you to insert variables, such as a client number or customer ID, into the URL.

Example

The following example uses the $clientNumber variable as a path parameter in a POST request:

var $clientNumber = getLoggedClientNumber(); // Or read the value from a CSV file

var $url = $server + "/customer/" + $clientNumber + "/reports";

var $payload = {
    "action": "listinvoices",
    "from": "10/01/2020"
};

var $response = post($url, $payload);

var $list = JSON.parse($response.getDataString());

How it works

If $server contains:

https://example.com

and $clientNumber contains:

12345

the resulting URL will be:

https://example.com/customer/12345/reports

In this example:

  • $server contains the base URL of the API.
  • $clientNumber contains the dynamic value used as the path parameter.
  • /customer/ and /reports are static parts of the endpoint path.
  • post() sends the request to the dynamically constructed URL.
  • JSON.parse() converts the response data into a JavaScript object.

Using a CSV Value

The path parameter can also come from test data, such as a CSV file:

var $clientNumber = $clientNumberFromCSV;

var $url = $server + "/customer/" + $clientNumber + "/reports";

var $response = post($url, $payload);

This approach allows the same Service Suite script to execute the request for different client numbers without changing the endpoint manually.

Summary

Use JavaScript string concatenation when a value in the API endpoint needs to change dynamically during execution:

var $url = $server + "/customer/" + $clientNumber + "/reports";

This is useful for endpoints that follow patterns such as:

/customer/{clientNumber}/reports
/customer/{customerId}/invoices
/orders/{orderId}/details

Last updated: August 17, 2026

If you have any feedback on this topic, please contact us at documentation@appvance.ai.