I am attempting to make an API call from a Salesforce Marketing Cloud Cloudpage App via SSJS, using Pardot API to determine if an email address exists within Pardot to verify that an email was sent to the specific email address from Pardot.
- Customer lands on Cloudpage, and email address is captured
- Token is requested from SF Connector App and successfully returned
- API call with token to Pardot endpoint including email address (from step 1), returns an error.
The token is requested as such with relevant client_id, client_secret
https://clients--uat.sandbox.my.salesforce.com/services/oauth2/token
This returns valid token,
{"access_token":"XXXX",
"signature":"XXXX",
"scope":"pardot_api",
"instance_url":"https://clients--uat.sandbox.my.salesforce.com",
"id":"https://test.salesforce.com/id/XXXX",
"token_type":"Bearer",
"issued_at":"XXXX"}
Using the token on the following endpoint,
https://pi.demo.pardot.com/api/prospect/version/4/do/read/email/[email protected]?format=json
The Pardot-Business-Unit-Id also checks out as if I change this it will complain. Payload returns with same error no matter what email address I use,
{
"@attributes": {
"stat": "fail",
"version": 1,
"err_code": 4
},
"err": "Invalid prospect email address"
}
Is there an issue with my flow, am I using the wrong endpoint? Could it be possible that there are no prospect email addresses in the account as it is a sandbox account? Any assistance with this would be very much appreciated.