Skip to main content

Customizing responses

Certain endpoints allow you to customize the response to get additional data from one call. Use this feature to reduce the number of API calls in your integration layer to increase performance.

Example

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.

Customizing responses in V2#

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 will return an extra property for each entity you use in responseContent.

Example#

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",  }}

Customizing responses in V1#

Some V1 endpoints return a meta object in their response, for example the Update customer session endpoint v1 or

The content of this object can contain, depending on the context:

  • all custom attribute values for all triggered campaigns and the coupon
  • the reasons why a coupon was rejected

The meta object can contain various object:

If effects are triggered by the request, you receive a campaigns object. The campaigns object contains the campaign id and all the custom campaign attributes.

meta: {  campaigns: {    "1": {      attributes: {        rrp: 34.95,        Brand: "Nike",        ProductOnSale: false      }    }  }}