Introduction:

Headers

Often when setting up a webhook or API call in LeadsHook the request will fail even though it looks 100%

The reason for this in many cases is that the content-type request header is missing.

The content-type request header tells the server what format we are using for our payload. The most common formats are the standard POST request, JSON, or XML.

  • For a standard POST request we setup our header like so:
content-type: application/x-www-form-urlencoded

  • For a JSON POST request we setup our header like so:
content-type: application/json

  • For XML POST requests we setup our header like so:
content-type: application/xml

Payload structure

Standard POST request

  • If you are using a standard POST request you will need to format your parameters as key=value pairs separated by an & symbol.

Note that the last entry should not have an & symbol.

For example:

first_name={first_name}&last_name={last_name}&email={email}&phone={mobile}

JSON request

  • If you are using JSON you will need to surround your group of parameters with curly brackets. Then each parameter is a specified as a “key”:”value” pair separated by a comma.

Note that the last entry should not have a comma.

For example:

{
"first_name":"{first_name}",
"last_name":"{last_name}",
"email":"{email}",
"phone":"{mobile}"
}