0

We have 2 millions prospects in our Pardot account and we want to get some of the prospects. How to get those prospects based on custom field? We use Pardot API version 4 in our code base, but there's no search criteria by custom field.

I was trying to query all of our prospects by code, output mode equals simple and filter all custom field by a value, due to each query has a 200 results limit, I have to do this process many times. But during the running of the code, it stops at some point and I couldn't keep continue query that unless running from the beginning. There's no problem with daily API call limit and api_key timeout, I checked them.

Is there any better way to get that? Thanks

0

I think the issue is with API key i.e. it expires after one hour of processing. You need to write logic of generating the new key on expiration. Something like below:

      do{
            //reset
            invalidAPIKey=false;
            api_key = getAPIKey();
            getData();
        }while(invalidAPIKey);

getData() will be recursively called until there is no record, like below:

//recursive condition
if(obj.get("result") == null){

    if(json.containsKey("err_code")){
        String errCode = json.get("err_code").toString();
        //invalid API key
        if(errCode != null && errCode.equals("1")){
            //update flag
            invalidAPIKey=true;
        }//api error
    }

    return;
}
//recursive call to get all possible items
getData();
  • Thanks for your comment. I got the customized list by using Pardot console, create a rule, execute it and save the prospect to a new list, then export it. Thanks, anyway. – Xiufeng Chen Jan 10 '18 at 17:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.