Customizing responses
Certain endpoints allow you to customize the response to get additional data from one call. Use this to increase performance in your integration layer.
Let's imagine that we must update a session using the Update customer session endpoint and that our workflow requires us to fetch the customer profile data to complete some logic after this.
In theory, we should use the Update customer session
and Get customer profile data
endpoints to complete our task.
Talon.One's design helps us skip the
Get customer profile data
call. We just set the responseContent
property
to customerProfile
in the Update customer session
endpoint to get everything we
need in one call.
When using the
Update customer session endpoint
or Update customer profile endpoint,
you can set the responseContent
property to a number of values, such as
customerProfile
, triggeredCampaigns
, loyalty
and more.
The response returns an extra property for each entity you use in responseContent
.
Example
- Customized response
- Default response
Setting responseContent=["customerProfile","event"]
in the request
returns the following example payload:
{
"customerSession": {
"integrationId": "2354382gy",
"created": "2021-08-24T14:15:22Z",
"applicationId": 32
},
"customerProfile": {
"id": 0,
"created": "2019-08-24T14:15:22Z",
"integrationId": "string",
"accountId": 0,
"closedSessions": 0,
"totalSales": 0,
},
"event": {
"id": 0,
"created": "2019-08-24T14:15:22Z",
"applicationId": 0,
"profileId": "string",
"type": "string",
}
}
Not setting responseContent
in the request
returns the following default example payload:
{
"customerSession":
{
"integrationId": "2354382gy",
"created": "2021-08-24T14:15:22Z",
"applicationId": 32,
...
}
}