Configuration for Response
When configuring the Web Services application, map the schema attribute as follows for JSON and XML.
-
Single endpoint – Refer the following example:
Example for mapping the schema attributes with JSONIn the above JSON response, all the attributes can be mapped as follows considering Root Path as
$.list
:CopyId = id
displayName = displayName
username = jive.username
enabled = jive.enabled
emails = emails[*].value -
-
Multiple endpoints – Refer to the following response example for the first and second endpoints:
Type
Response Example
Response Mapping
First endpoint
Copy{
"meta": {
"query_time": 0.141557942,
"powered_by": "csam",
"trace_id": "8fe96ed0-4da3-42ab-b97a-4651e39f7d67"
},
"resources": [
{
"01dcc3dd-5b72-4fb2-a43b-424e092bd6af",
"032b704e-1467-48b3-ad70-29a04f1a20ab",
"042ab092-918f-4ed3-97eb-196fbe917e77",
}
],
"errors": []
}Response Attribute Mapping:
uid = $
Root Path:
$.resources.*
Second endpoint
Context URL –
/users/entities/users/v1?ids=$response.uid$
Example:
Copy{
"meta": {
"query_time": 0.042584188,
"powered_by": "csam",
"trace_id": "0973beb6-8afe-452c-bac4-18d17cc3e9ef"
},
"resources": [
{
"uid": "john.doe@santander.us",
"firstName": "John",
"lastName": "Doe",
"uuid": "01dcc3dd-5b72-4fb2-a43b-424e092bd6af",
"customer": "81971f9d094d494bae5a5fd97052509f"
}
],
"errors": []
}Response Attribute Mapping:
firstName = $.resources[0].firstName
lastName = $.resources[0].lastName
Root Path: Root path not required
-
Parsing JSON Array – The following is an example for parsing JSON array:
[1,10,21,31,46,89,90,67,88,98,101]
The response mapping for above example is:
Response Attribute Mapping (id is attribute in the schema):
id = $
-
Root Path:
$.*
-
-
Example 1 – XML response for mapping:
Copy<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns="urn:partner.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:sf="urn:sobject.partner.soap.sforce.com">
<soapenv:Header>
.....
.....
</soapenv:Header>
<soapenv:Body>
<queryResponse>
<result xsi:type="QueryResult">
<done>true</done>
<queryLocator xsi:nil="true"/>
<records xsi:type="sf:sObject">
<sf:type>User</sf:type>
<sf:Id>123456</sf:Id>
<sf:Id>123456</sf:Id>
<sf:Alias>Alias</sf:Alias>
<sf:City xsi:nil="true"/>
<sf:CommunityNickname>CName1</sf:CommunityNickname>
<sf:Email>test@test.com</sf:Email>
<sf:IsActive>false</sf:IsActive>
<sf:Username>test@test.com</sf:Username>
<sf:FirstName>Test</sf:FirstName>
<sf:LastName>Test</sf:LastName>
</records>
<size>1</size>
</result>
</queryResponse>
</soapenv:Body>
</soapenv:Envelope>The following figure provides an example of the XPath Namespace mapping for XML Web Services:
-
Example 2 – XML response for mapping:
Copy<?xml version="1.0" encoding="UTF-8" standalone="yes"?><userList id="5457373">
<name>DillardsEveryone</name>
<memberList>
<listMember>example@example.com</listMember>
<listMember>gage5.test5@test5.dillards.com</listMember>
</memberList>
</userList>The following figure provides an example of the Root Path configuration for listMember: