Skip to main content

How to use Path Parameters in Service Suite?

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

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

using

Example

javascript

The string concatenation expressions that can include variables. So forfollowing example inuses the following snippet the$clientNumber variable $clientNumberas isa usedpath parameter in the path of the URL of a POST call:request:

var $clientNumber = getLoggedClientNumber(); // or can beOr read the value from a CSV file
var $url = $server + “"/customer/“" + $clientNumber +” "/reports”reports";
var $payload = { “action“"action":”listinvoices” "listinvoices",”from” "from":”10/01/2020” "10/01/2020" };
var $response = post($url, $payloadpayload); );
var $list = JSON.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: MarchAugust 21,17, 20232026

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