For any given lead I know I can get it's Activity through the Get Lead Activities endpoint. My problem is I want to get the first ever activity recorded for that lead all the way to the last. Is there a way to do this? If I try I date set way in the past (epoch) I get the following response:
{
"requestId": "15fe4#153d32d6653",
"success": true,
"nextPageToken": "5HGU7ZC75UN24BUTN4FPNOQBN35Z4CKALKKTBL5JNUADVGEJNW3A====",
"moreResult": true
}
Would I have to go through each pageToken till I get data? Is there a way to get the date of the first activity record for a lead?
Thanks.
Hi Sean,
My understanding is that you will need to export them all and filter out from the exported data.
-Greg
Hi Greg,
Is there an easy way to export all activity for a lead through the REST API?
Sean
Hi Sean,
Other than the Get Lead Activities » Marketo Developers endpoint, no. This endpoint will really return all the activities. Then you will be able to filter the resulting files.
-Greg
Hi Greg,
Right, I guess my question is how do I determine what pageToken to get to retrieve all of the data?
Thanks,
Sean
Hi Sean,
I am not a dev, but my understanding is that the first set of retreived data will come with a pagetoken that will enable you to continue fetching, 300 rows at a time. When you have exhausted all the activities, the pagetoken will return empty with the last set of data.
-Greg
Greg,
Thanks for all your replies. I do understand I can continue getting all activities until they are exhausted. I am having problems getting the earliest data efficiently. I need to figure out what date to use in the Get Paging token call to use in my first call to Get Lead Activities that will ensure I get the first activity that exists.
Thanks,
Sean
Hi Sean,
You cannot use the Get Paging Token since you do not know the date in the first place The get paging token is the date at which you want to start returning the activities, but you cannot know, when you set that date, if there is data older or not.
I do not see any other possibility than fetching all the data for the lead with the getactivity and determine what is the earliest one when you have them all.
-Greg
Hi Greg,
The problem stems from when fetching the activity for the Lead the nextPageToken is required so I cannot simply return all activities. This is looking like it is impossible in the REST API. I tested this with the SOAP API and I can accomplish getting all activities for a lead very easily. Do you know if there are plans to deprecate the SOAP API anytime in the future?
Thanks,
Sean
Hi Sean,
I think you are making a mistake here. We have done some dev in the past that retrieve all activities without any issue.
The nextpageToken is not provided by the Get Paging API, it is return by the GetActivity API, only if there are some records left to fetch.
-Greg
Hi Greg,
From what I'm reading here http://developers.marketo.com/documentation/rest/get-lead-activities/ :
"For the first call, use the Get Paging Token API to get nextPageToken. For subsequent calls to this endpoint, use the nextPageToken returned from the response. This endpoint will always return the nextPageToken."
The nextPageToken is provided by the Get Paging API but only for the first call. You are correct in that after making the first call the nextPageToken from the GetLeadActivity is used.
In the table below that for parameters it states the nextPageToken is required. If I do a call without the token I get the following response:
{
"requestId": "a854#153ec8999c9",
"success": false,
"errors": [
{
"code": "1002",
"message": "Missing value for required parameter 'nextPageToken'"
}
]
}
So to make the first call I do need to call Get Paging API and without knowing what date to use, makes grabbing all the activity for a lead impossible.
You say there was some dev in that past to get the data. It seems that is in the SOAP API but not the REST API.
Sean
Hi Sean
I would put the date at which you started to use Marketo, or, if I do not know the date the instance started, 01/01/2006, as I think Marketo was not even created at this date. You'll be sure to retrieve all the lead activities.
-Greg
Or 90 days before the lead's create date, which will get the data in the lion's share of cases.