Need
When declaring a REST client in Semarchy xDM, it can be unclear what to enter in the Value Selector of a Response Output, or the selector returns nothing when the client is tested.
Summarized Solution
The Value Selector is a JSONPath expression that starts at the root of the response payload ($) and points to a single value. The REST clients documentation describes the field and the Response processing section gives examples.
The quickest way to get the right path is to work outside xDM first:
- Make the API call work in a tool such as Postman and copy the response.
- Find the path with a JSONPath finder tool, by pasting the response and clicking the value.
- Check the path in a Jayway-compatible JSONPath evaluator, since xDM uses the Jayway JSONPath syntax.
- Paste the path in the Value Selector and run Manage > Test in the REST Clients editor.
If the expression returns an array, xDM keeps only its first element.
Detailed Solution
A REST client extracts each response output from the response body with a JSONPath expression.
Take this payload:
{
"customers": [
{
"first name": "Joe",
"last name": "Celko",
"age": 58
},
{
"first name": "Roger",
"last name": "Moore",
"age": 69
}
],
"customers_count": 2
}These selectors return the following values:
| Value Selector | Returns |
| $.customers_count | 2 |
| $.customers[0].age | 58 |
| $['customers'][0]['age'] | 58 (same value, bracket syntax) |
| $['customers'][1]['last name'] | "Moore" (bracket syntax is needed for names with a space) |
If an expression returns an array, such as $.customers[*].age, only the first element (58) is kept as the output.
Step 1: get a working response
Call the API in an external tool such as Postman, using the same URL, headers and body as in the REST client. When the call works, copy the response body.

Step 2: find the path
Paste the response in a JSONPath finder tool, then click the required value.
The tool displays the matching path.
Some finder tools prefix the path with a variable name such as x. instead of $.
In xDM the path must start from the root with $, so replace that prefix, for example x.customers[0].age becomes $.customers[0].age.

Step 3: validate the path
xDM follows the Jayway JSONPath syntax. Because finder tools do not all use the same syntax, paste the response and the path in a Jayway-compatible evaluator and check that it returns the expected value.

Step 4: set the Value Selector
- In the Configuration module, select REST Clients and open the REST client.
- In the Response Output table, select the output (or click Add Output to create it), then fill its Name, Label and Description.
- Paste the path in Value Selector.
- Set the Data Type of the output.
- Choose the Behavior on Absent Value (fail, or return the default value) and the Behavior on Data Type Mismatch (fail, or return the default value). Optionally set a Default Value.
- Save.

Step 5: test the REST client
- In the REST Clients editor toolbar, select Manage > Test.
- Enter values for the request inputs and click Execute.
- Check that the output shows the expected value.

The REST client is now ready to be used in an API enricher.
If the test does not return the expected value:
- Empty or default value: the path returned nothing. Because the behavior on absent value is set to return the default value, a wrong path looks like an empty or default result. Re-check the path in the evaluator against the exact response returned by the test.
- Failure on a value that exists: check the data type of the output against the value returned, and the behavior on data type mismatch.
- Error raised on a successful call: the Error Selector (Advanced Configuration section) is also evaluated on successful responses. If it returns a value, the error is raised, so make sure it only matches a real error field.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article