Pardot Examples

Note: Pardot's API is in XML - however chaining only supports JSON. This means that for individual calls you'll receive back mock XML, but for the chain it will be formatted in JSON.

Example 1

In this example we will be making a Pardot request to either update or insert a new user. This will require just three calls, but the calls will be conditional based on responses. This means that traditionally we would need to first make a call to see if the user exists, perform logic on that call, and then perform the secondary call like so:

  1. First we need to get our API key via POST
    GET http://api-multi-request.demos.mikestowe.com/pardot/api/login/version/4/
  2. Now call prospect/read to see if the email already exists in our database
    GET http://api-multi-request.demos.mikestowe.com/pardot/api/prospect/version/4/do/read/email/email@mycompany.net?api_key=123456&user_key=1234567890
  3. If the email exists, update the user.
    GET http://api-multi-request.demos.mikestowe.com/pardot/api/prospect/version/4/do/update/id/1?api_key=123456&user_key=1234567890

    Otherwise, insert the user
    GET http://api-multi-request.demos.mikestowe.com/pardot/api/prospect/version/4/do/create/email/email@mycompany.net?api_key=123456&user_key=1234567890

However, using a chain, we can make all the calls with a single HTTP POST Request like so:


http://api-multi-request.demos.mikestowe.com/pardot/api/multirequest

[{
		"doOn": "always",
		"href": "/login/version/4/",
		"method": "post",
		"data": {
			"email": "admin@mycompany.net",
			"password": "myPassword",
			"user_key": "1234567890"
		},
		"globals": {
			"api_key": "body.api_key"
		},
		"return": ["api_key"]
	},
	{
		"doOn": "200",
		"href": "/prospect/version/4/do/read/email/email@mycompany.net?api_key=${global.api_key}&user_key=1234567890",
		"method": "get",
		"data": {},
		"return": ["id"]
	},
	[
		[{
			"doOn": "200",
			"href": "/prospect/version/4/do/update/id/${body.id}?api_key=${global.api_key}&user_key=1234567890",
			"method": "get",
			"data": {},
			"return": true
		}],
		[{
			"doOn": "400",
			"href": "/prospect/version/4/do/create/email/email@mycompany.net?api_key=${global.api_key}&user_key=1234567890",
			"method": "get",
			"data": {},
			"return": true
		}]
	]
]

Or to test the flow for a user that doesn't exist:


http://api-multi-request.demos.mikestowe.com/pardot/api/multirequest

[{
		"doOn": "always",
		"href": "/login/version/4/",
		"method": "post",
		"data": {
			"email": "admin@mycompany.net",
			"password": "myPassword",
			"user_key": "1234567890"
		},
		"globals": {
			"api_key": "body.api_key"
		},
		"return": ["api_key"]
	},
	{
		"doOn": "200",
		"href": "/prospect/version/4/do/read/email/fake@mycompany.net?api_key=${global.api_key}&user_key=1234567890",
		"method": "get",
		"data": {},
		"return": ["id"]
	},
	[
		[{
			"doOn": "200",
			"href": "/prospect/version/4/do/update/id/${body.id}?api_key=${global.api_key}&user_key=1234567890",
			"method": "get",
			"data": {},
			"return": true
		}],
		[{
			"doOn": "400",
			"href": "/prospect/version/4/do/create/email/fake@mycompany.net?api_key=${global.api_key}&user_key=1234567890",
			"method": "get",
			"data": {},
			"return": true
		}]
	]
]