Get total count of activities with REST API

Anonymous
Not applicable

Get total count of activities with REST API

I need to know the total number of activities in a specific date range but I can't find out how to do it with REST API.

What I thought is to query for every activity type and take the last activity id. But, I don't sure that this id number will be the real number of activities.
Do you have any better suggestions?

Bonus question - I can't find how much it costs to upgrade the 10,000 API calls limit and to what new limit it will upgraded to. Where can I find this information?

Tags (1)
3 REPLIES 3
Anonymous
Not applicable

Re: Get total count of activities with REST API

Hi Apps Pyramid..

This is a tricky one..  In the past, I've used the SOAP API because it has a activityCreatedAt filter.

http://developers.marketo.com/documentation/soap/getleadchanges/

You could use 'Get Lead Activities' REST API call with a listid filter (if you have a smart campaign in MKTO to add/remove from a static list).

A potential issue I see is that 'data change value' could inflate the total count. You may want to specify which types of activities you would like to return. I don't have a list of activity type Ids handy, but this API call might help:

Get Activity Types » Marketo Developers

Hopefully MKTO staff or a Champion will have a better idea.  😃

Anonymous
Not applicable

Re: Get total count of activities with REST API

Mark Price, thank you for your answer.

I didn't quite understand why the "activiCreatedAt" of the soap API will be of any help. I believe I have the same thing in the REST API. As I wrote, I can get the last activity id by searching for activities with nextPageToken that reflects the last minutes or so.

Moreover, I didn't understand your remark  about the smart list. As for as I know, the querying is limited to static lists only. Did you mean that I can convert a smart list to a static list?

Last, it will be great to hear more suggestions in order to try and solve this issue.

Anonymous
Not applicable

Re: Get total count of activities with REST API

Hi Apps,

Glad to provide some input that might help 

Apologies, you are correct on the paging token having the same function as the "activityCreatedAt". It's been awhile since the project that used the 'getleadchanges', but I do remember there being something in the SOAP API that wasn't on the REST side- maybe it was the 'LeadKeySelector' which may not matter for your use case.

You are correct that the querying is limited to static lists.  As a workaround, you can create 'Smart Campaigns' and use 'Triggers' to add/remove from Static Lists as the criteria is met.  Here's an example for something similar but for new leads (your triggers will be specific to your spec):

Screen Shot 2015-08-06 at 1.23.53 PM.png

The Flow step looks like so:

Screen Shot 2015-08-06 at 1.25.13 PM.png

The end result should be static list that changes as needed, so your API script will have the right data set from the list id filter.