Re: API questions: Programs and Lead Activity

Jep_Castelein2
Level 10

Re: API questions: Programs and Lead Activity

Hi Dan, 2,500 Programs are downloaded in 13 API calls (batch size 200) so - while I agree it would be convenient to filter on 'last updated' - it's not a huge hog of API calls. Not sure if you're planning to download folders, emails, landing pages, forms or files, but the API pretty works the same for all assets: you have to download everything every time.

Dan_Stevens_
Level 10 - Champion Alumni

Re: API questions: Programs and Lead Activity

Thanks Jep - that's good to know (and the team is sticking with this approach). 

Hope you're doing well - long time, no talk!

Anonymous
Not applicable

Re: API questions: Programs and Lead Activity

Hi Dan,

We are looking at pulling all emails and programs and store this data in our DB.

We still have not figured out how to pull more than 200 rondom records.

We want to know how this can be done by several API calls.

do you have an example for that call?

Idan

Anonymous
Not applicable

Re: API questions: Programs and Lead Activity

Jep Castelein​  Do you have an example for that? How can I download 2500 programs and emails in 13 API calls (batch size 200)?

Because now I am using this call:  https://891-VEY-973.mktorest.com/rest/asset/v1/programs.json?access_token=<access token>&maxReturn=200

and each time I am getting the same 200 records and I don't know how I can download the next 200 programs and then the next 200 programs and so on...

Thank you!

Shiran

Casey_Grimes
Level 10

Re: API questions: Programs and Lead Activity

Hi Shiran (and Idan Dayag​),

There are a few different ways to get around this based on your request parameters; the easiest (and the sanest for me in terms of structuring where to send data) has been to actually modify my approach and use byTag to replicate the structure inside the Marketo instance. However, what you're probably looking for is to use the offset parameter. So, if you have 2500 program, your first call would be

https://891-VEY-973.mktorest.com/rest/asset/v1/programs.json?access_token=access token&maxReturn=200

But your subsequent calls would be

https://891-VEY-973.mktorest.com/rest/asset/v1/programs.json?access_token=access token&maxReturn=200&offset=200

https://891-VEY-973.mktorest.com/rest/asset/v1/programs.json?access_token=access token&maxReturn=200&offset=400

https://891-VEY-973.mktorest.com/rest/asset/v1/programs.json?access_token=access token&maxReturn=200&offset=600

etc. through all the calls you need.

Jep_Castelein2
Level 10

Re: API questions: Programs and Lead Activity

Add ‘offset=200’ to your call to get the 2nd batch