Re: Questions about getting all unsubscribed leads

Anonymous
Not applicable

Questions about getting all unsubscribed leads

Hi everyone!

I am using the Marketo REST API.

I would like to get all the leads that have been unsubscribed since specific date

So the first api call looks like that:

https://<baseurl>/rest/v1/activities/pagingtoken.json?access_token=<***>&sinceDatetime=2017-01-01'T':01:01

Then in the response i get the "nextPageToken", so i sent another API call to get specific fields:

http://<baseUrl>/v1/activities/leadchanges.json?access_token=****&nextPageToken=****&fields=unsubscribed,guid

In the response I'm NOT getting the guid field(custom field)

{

  "id" : 123456,

  "leadId" : 235987,

  "activityDate" : "2017-01-10T16:07:48Z",

  "activityTypeId" : 13,

  "fields" : [{

  "id" : 75,

  "name" : "unsubscribed",

  "newValue" : "true",

  "oldValue" : "false"

  }

  ],

  "attributes" : [{

  "name" : "Reason",

  "value" : "Manual lead edit"

  }, {

  "name" : "Source",

  "value" : "Lead update"

  }

  ]

  }

Additional questions:

1. How can I fetch all the leads which their unsubscribed field has 'true' value?

2. How can I fetch custom fields?

Thanks!

Tags (2)
1 REPLY 1
SanfordWhiteman
Level 10 - Community Moderator

Re: Questions about getting all unsubscribed leads

The fields param refers to the fields whose updates will be shown.  If there weren't any changes to that field in the timeframe, there wouldn't be any matching results.

You can't directly fetch all leads who have Unsubscribed = true because the cardinality is too low. See this other recent thread for pointers: export leads that have not unsubscribed using rest api