Response parsing

This document outlines the possible options that you can use in your payload body editor when setting up buyers API requests in your campaigns.

JSON

We will reference the following JSON document in our examples:

  • to read the status field, you will need to use status as the key
  • to read the created_at, you will need to use metadata/created_at as the key
  • to read the buyer id, you will need to use the metadata/buyer/id as the key
  • to read the first item in the price array, you will need to use metadata/prices/0 as the key. To read second price, use metadata/prices/1. Note that index keys start from 0
  • to read the value of the first item in the props array, you will need to use metadata/props/0/value as the key. To read the second item's value, use metadata/props/1/value


XML

We will reference the following XML document in our examples:

  • to read the bidAmount field, use /success/bidAmount as the key
  • to read the contact first name, use /success/customer/contact[@name="first_name"] as the key
  • to read the email, use /success/customer/contactMethod[@type="email"] as the key
  • to read the address city, use /success/customer/address/city as the key
  • to read the first offer value, use /success/customer/numbers/value[1] as the key. To read second offer value, use /success/customer/numbers/value[2]. Note that the index keys start from 1
  • to read the the attribute value of a property (ex: id attribute of bidAmount property), use /success/bidAmount/@id. This will return 8123123


Important notes

  • XML: we do not support nested namespaces. In the example above, we cannot read the debug id, as it is contained in a separate namespace from the rest of the document
  • XML and JSON: limited array parsing. As shown in the examples, you can read individual values from an array, but you will need to know the correct index(key) of the item in the array. We also do not recommend parsing and using values from arrays unless you are sure that:
    • the array returned has always the same number of items. If you try to read a key
    • the items are returned in the same order every time
  • XML and JSON: invalid key configurations will return an empty string

Still need help? Contact Us Contact Us