SOLVED

I have a question on which API(s) to use for my particular use case

Go to solution
charlie_kim
Level 2

I have a question on which API(s) to use for my particular use case

Hi Marketo community members.

 

I've been using the API to try and pull data but the data I pulled so far doesn't seem to provide what I'm looking for. I am new to using the API's so I apologize in advance.

 

I have two email programs. I would like to pull lead and activity data for these two email programs so we can load them into our data lake for a POC. The data needs to include email, names, if the email was delivered/opened/clicked, web activity after the email program was received. Which API's should I use to achieve this? I'm thinking it's going to be a combination of API's and linking it by leadId?

 

Thank you!

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Amit_Jain
Level 8 - Community Advisor

Re: I have a question on which API(s) to use for my particular use case

The data that you are trying to pull needs multiple calls to the different API endpoints. You have to collect the raw data in some outside database and then combine that to create the reports you are trying to generate from there.


I have two email programs. I would like to pull lead and activity data for these two email programs so we can load them into our data lake for a POC. The data needs to include email, names,


For the above data set, you have to use the following API endpoint, this will provide you the list of program members and you can fetch the fields that you want by specifying that in the "fields" query parameter in comma-separated values.

https://developers.marketo.com/rest-api/endpoint-reference/lead-database-endpoint-reference/#!/Leads...

 

if the email was delivered/opened/clicked, web activity after the email program was received. 

To get the delivered/opened/clicked, and web activity, you have to use the activity APIs.

 

You have a list of leadIDs garbed from the first API call, you can use the following API call to fetch the required activities. You can fetch up to 30 lead's activity in a single API call. This will give the activity history for all the email sent, you can limit that by specifying the assetIds in the query parameter string. You can add comma separated IDs of all the emails for which you are trying to pull the data.

 

https://developers.marketo.com/rest-api/endpoint-reference/lead-database-endpoint-reference/#!/Activ...

 

Let me know if you have further questions.

View solution in original post

6 REPLIES 6
Amit_Jain
Level 8 - Community Advisor

Re: I have a question on which API(s) to use for my particular use case

The data that you are trying to pull needs multiple calls to the different API endpoints. You have to collect the raw data in some outside database and then combine that to create the reports you are trying to generate from there.


I have two email programs. I would like to pull lead and activity data for these two email programs so we can load them into our data lake for a POC. The data needs to include email, names,


For the above data set, you have to use the following API endpoint, this will provide you the list of program members and you can fetch the fields that you want by specifying that in the "fields" query parameter in comma-separated values.

https://developers.marketo.com/rest-api/endpoint-reference/lead-database-endpoint-reference/#!/Leads...

 

if the email was delivered/opened/clicked, web activity after the email program was received. 

To get the delivered/opened/clicked, and web activity, you have to use the activity APIs.

 

You have a list of leadIDs garbed from the first API call, you can use the following API call to fetch the required activities. You can fetch up to 30 lead's activity in a single API call. This will give the activity history for all the email sent, you can limit that by specifying the assetIds in the query parameter string. You can add comma separated IDs of all the emails for which you are trying to pull the data.

 

https://developers.marketo.com/rest-api/endpoint-reference/lead-database-endpoint-reference/#!/Activ...

 

Let me know if you have further questions.

charlie_kim
Level 2

Re: I have a question on which API(s) to use for my particular use case

Thank you, Amit, I will play around with these endpoints and see if it works out.

SanfordWhiteman
Level 10 - Community Moderator

Re: I have a question on which API(s) to use for my particular use case

If a certain Email Asset ID is known to only be sent in a certain Program context (for example, it's an Email contained within the Email Program, or some naming convention indicates the firm relationship) then you don't need to check whether someone is in the Program. You can safely interpret Sent Email as meaning they were in the Program.

charlie_kim
Level 2

Re: I have a question on which API(s) to use for my particular use case

Thanks for the reply. Does your guidance still hold true for Amit's reply or should I experiment with a different API endpoint?

charlie_kim
Level 2

Re: I have a question on which API(s) to use for my particular use case

I see what you're saying. If there is only one email asset in the program, we can assume the activity type Ids is for that email.

SanfordWhiteman
Level 10 - Community Moderator

Re: I have a question on which API(s) to use for my particular use case

You can assume the activities related to that Email are related to the Program.