How to check user exist or not in pardot prospect using api-php

The Pardot API should be accessed via POST for all operations . For the most part the API does not use the standard HTTP response codes to convey the outcome of the request, rather it always returns 2 response codes and sends back its own set of status codes that need to be handled.

Steps for the check user in prospect :

Step 1 : Login to pardot by api :

$url = “https://pi.pardot.com/api/login/version/3?email=useremail@email.com&password=pardot_password&user_key=********************************”;

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($ch);

$xml = simplexml_load_string($response);
$json = json_encode($xml);
$array = json_decode($json,TRUE);

$api_key = $array[‘api_key’];

Above API will return access token in response(api_key).

Step 2 : Check user :

$url = “https://pi.pardot.com/api/prospect/version/4/do/read/email/search_user_by_email?user_key=********************************&api_key=$api_key”

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($ch);

 

If user exist then it will return [{“stat” : “ok”] otherwise it will return [{“stat”:”fail”}]

 

In the same way we can check user in pardot account also;

Repeat the above step for check user in account, there are only single change in second api.Replace prospect with account.

https://pi.pardot.com/api/acount/version/4/do/read/email/search_user_by_email?user_key=********************************&api_key=api_key


Need more help?

Hi there, was your problem or query resolved? If not & need more assistance, please do reach out to us at info@nanostuffs.com, we'll be more than delighted to help. Nanostuffs has 7+ years of extensive Salesforce & iOS/Android experience.
Holler Box