Request mapping
Each leg’s request.fields object builds the body that Pingdex sends to the buyer. Every key is a destination in the body, and every value is a mapping that says where the value comes from.
{ "fields": { "Email": { "type": "field", "source": "payload.email" }, "Source": { "type": "static", "value": "pingdex" } }}fields must contain at least one entry.
Mapping types
Section titled “Mapping types”Each mapping has a type. Only the keys listed for that type are allowed. Any other key is rejected.
type |
Required keys | Takes its value from |
|---|---|---|
field |
source |
The lead. |
static |
value |
A constant you write into the integration. |
secret |
secret |
A named secret stored with the provider. |
response |
leg, source |
A value extracted from an earlier quote response. |
All four types also accept the optional keys optional and transform.
Copies a value from the lead. The source must be one of:
| Source | Value |
|---|---|
lead.id |
The Pingdex lead UUID. |
lead.external_id |
The external_id you sent when submitting the lead. |
payload.<path> |
A value from the lead payload, for example payload.email or payload.address.city. |
Rules for payload paths:
- Separate nested keys with dots. Each segment must be non-empty and cannot be only digits, so you cannot index into arrays.
- The value at the path must be a string, number or boolean. A missing key, a
null, an object or an array counts as missing. lead.external_idcounts as missing when the lead has no external ID, or when it is empty.
static
Section titled “static”Writes a constant. The value can be a string, number or boolean.
secret
Section titled “secret”Writes the value of a named secret, for example { "type": "secret", "secret": "api_token" }. The mapping holds only the name. See Authentication.
response
Section titled “response”Copies a value that an earlier quote leg extracted from its response. The leg must name an earlier quote leg, and source must be a name defined in that leg’s response.extract.
{ "TransactionId": { "type": "response", "leg": "ping", "source": "transaction_id" }}This pairs with an extract on the quote leg:
{ "response": { "accepted": "accepted", "bid": "bid", "extract": { "transaction_id": "data.transaction_id" } }}If the buyer’s ping response does not contain a required extracted value, or the value is empty or not a simple value, that provider’s quote is rejected with missing_response_value, so the provider cannot win the auction. See Response mapping.
Optional fields
Section titled “Optional fields”Add "optional": true to omit a field when its value is missing, instead of failing.
{ "type": "field", "source": "payload.phone", "optional": true }- By default a missing value stops the leg. Pingdex sends nothing and records a
not_sentattempt withmissing_mapped_field. (A missing extracted value usesmissing_response_value.) - With
optional, a missing ornullvalue is left out of the body. - If omitting a value leaves a parent object empty, the empty parent object is dropped too.
- An empty string is a value, not a missing one. It is still sent.
Transforms
Section titled “Transforms”Add a transform to change a string after it has been resolved.
transform |
Effect |
|---|---|
trim |
Removes whitespace from both ends. |
lower |
Converts to lower case. |
upper |
Converts to upper case. |
digits |
Keeps only the digits 0 to 9. |
{ "type": "field", "source": "payload.phone", "transform": "digits" }Transforms apply to strings only. Numbers and booleans pass through unchanged, and no other transform names are accepted.
JSON bodies and nesting
Section titled “JSON bodies and nesting”With encoding set to json (the default), a dot in a destination builds a nested object.
{ "fields": { "customer.email": { "type": "field", "source": "payload.email" }, "customer.address.city": { "type": "field", "source": "payload.city" }, "Source": { "type": "static", "value": "pingdex" } }}sends:
{ "customer": { "email": "alex@example.com", "address": { "city": "Leeds" } }, "Source": "pingdex"}Destinations cannot be empty, cannot contain an empty segment (such as a..b) and cannot have a segment made only of digits.
Form bodies
Section titled “Form bodies”With encoding set to form, Pingdex sends application/x-www-form-urlencoded. Form bodies are flat.
- Destinations cannot contain a dot. A nested destination such as
customer.emailis rejected. staticvalues must be strings. A number or boolean static value is rejected.
{ "request": { "method": "POST", "url": "https://buyer.example/post", "encoding": "form", "fields": { "email": { "type": "field", "source": "payload.email" }, "source": { "type": "static", "value": "pingdex" } } }}Destination conflicts
Section titled “Destination conflicts”Two destinations conflict when one is a parent path of the other. A destination that holds a single value cannot also hold nested values.
{ "fields": { "customer": { "type": "static", "value": "Alex" }, "customer.email": { "type": "field", "source": "payload.email" } }}customer would have to be both a value and an object, so the integration fails to compile with conflicting destination paths.
{ "fields": { "customer.name": { "type": "field", "source": "payload.name" }, "customer.email": { "type": "field", "source": "payload.email" } }}Both destinations share the parent customer but neither is the parent of the other.
Size limit
Section titled “Size limit”A request body can be at most 256 KiB. A larger body is not sent. See Ping and post.