Skip to content

Integration specification

The integration is the reviewable definition of how Pingdex talks to a buyer. It is a JSON object that describes an ordered list of request legs.

The integration object has exactly one key, legs. Any other root key is rejected.

{
"legs": [ /* one or two leg objects */ ]
}

Each leg has these keys. No others are allowed.

Key Required Description
name Yes A stable identifier for the leg.
role Yes quote or commit.
request Yes The HTTP request Pingdex sends.
response Quote: yes. Commit: no. How Pingdex reads the buyer’s reply.

An integration has one or two legs, in one of two shapes:

Shape Legs Dashboard badge
Commit only One commit leg. Direct post
Quote then commit One quote leg, then one commit leg. Ping / post

The rules that apply:

  • There must be exactly one commit leg, and it must be last.
  • There may be at most one quote leg, and if present it comes before the commit.
  • Anything else is rejected, for example two commits, a quote on its own, or a commit followed by a quote.

Names key headers, response references and attempt records, so they must stay stable.

  • 1 to 64 characters.
  • Must match ^[A-Za-z_][A-Za-z0-9_-]*$. Start with a letter or underscore, then use letters, digits, underscores or hyphens.
  • Unique within the integration.
Role Purpose
quote The ping. Asks the buyer for a bid and establishes that the provider is eligible for this lead.
commit The post. Submits the lead to the buyer for commercial acceptance.
Key Required Rules
method Yes POST only.
url Yes An absolute URL, up to 2,048 characters. Use https.
encoding No json (the default) or form.
fields Yes An object of destination to mapping. It must be non-empty.

Notes on each:

  • method: Pingdex only sends POST requests. Other methods are rejected.
  • url: Only http and https schemes compile, but in production Pingdex only sends to https destinations on public addresses. At send time, Pingdex also refuses a URL that contains a username, a password or a fragment. See Authentication.
  • encoding: json sends a JSON object body. form sends application/x-www-form-urlencoded. Form encoding allows flat destination names and string static values only. See Request mapping.
  • fields: Each key is a destination in the request body and each value is a mapping. There must be at least one field.

The response key describes how Pingdex reads the buyer’s reply. It is required on a quote leg and optional on a commit leg. The two forms differ. See Response mapping.

Headers and secrets are not part of the integration

Section titled “Headers and secrets are not part of the integration”

The integration never contains header values or secret values. Those are supplied alongside it when you save the provider, in the headers and secrets objects. The integration can only refer to a secret by name. See Authentication.

All values below are synthetic.

A single post leg. This is a direct post provider, suitable for a campaign that uses priority routing.

{
"legs": [
{
"name": "post",
"role": "commit",
"request": {
"method": "POST",
"url": "https://buyer.example/post",
"encoding": "json",
"fields": {
"Email": { "type": "field", "source": "payload.email", "transform": "lower" },
"Postcode": { "type": "field", "source": "payload.postcode", "transform": "upper" },
"Source": { "type": "static", "value": "pingdex" },
"ApiKey": { "type": "secret", "secret": "api_token" }
}
},
"response": {
"accepted": "status",
"accepted_values": ["Accepted"],
"rejected_values": ["Rejected"],
"transaction_id": "data.id",
"rejection_reason": "data.reason"
}
}
]
}

The response on a commit leg is optional. Leave it out if you do not need Pingdex to record commercial acceptance.

When an integration does not compile, the error names the failing path and the reason, for example legs.0.request.fields: empty. The most common causes:

Error Cause
unknown key A key that the object does not allow, including any root key other than legs.
commit leg must be last The final leg is not a commit.
exactly one commit leg is required There are no commit legs, or more than one.
at most one quote leg is permitted More than one quote leg.
legs.N.name: name not allowed or too long The leg name breaks the naming rule.
legs.N.name: duplicate Two legs share a name.
must be POST A method other than POST.
legs.N.request.fields: empty A request with no fields.

See Testing and troubleshooting for more.