APIs & Integrations

Benchmark_achen
Participant

Is there a way to speed up the Email Event get campaign IDs API?

SOLVE

Hi,

I'm trying to retrieve the email event (campaign) data from Hubspot into our database.  I'm trying to get the unique campaign ID using the following API.

All IDs:  https://api.hubapi.com/email/public/v1/campaigns/by-id

Recent IDs:  https://api.hubapi.com/email/public/v1/campaigns

Both of these API seems to take a very long time to run and they seem trying to retrieve over a million of records...Is there a way to make any of these two API run faster?  

 

My goal is to get the unique campaign IDs using either of the menioned API and then combine them with with another API to get the detailed data about each campaign.

 

Thank you in advance!

--Allan

0 Upvotes
2 Accepted solutions
WendyGoh
Solution
HubSpot Employee
HubSpot Employee

Is there a way to speed up the Email Event get campaign IDs API?

SOLVE

Hey @Benchmark_achen,

 

Have you tried setting a limit and loop through the results based on the hasMore and offset value? On my end, I have tried using the Get campaign IDs sorted by recent activity for a portal | Email Events API to retrieve all campaign IDs on portal 563xxxx and set a limit of 100 e.g.

 

https://api.hubspot.com/email/public/v1/campaigns?hapikey={{hapikey}}&limit=100

 

The response returned was pretty instant. In this case, would you mind clarifying how long it took for you when you run the two endpoints?

View solution in original post

Benchmark_achen
Solution
Participant

Is there a way to speed up the Email Event get campaign IDs API?

SOLVE

Thank you @WendyGoh !

 

Based on your response and the fact that I wasn't able to get any of these two APIs to finish during my testing (I stopped them after a few hours), I finally realized that there must have something to do with stop indicator.  I use ZappySys JSON Source SSIS component to run these APIs.  In the component, I set the Array Filter to $.campaign which is one level down from the parent.  But, the hasMore indiciator is at the parent level.  Therefore, when I use the default $.hasMore = false to stop the execution, it has no effect.  I have to manually type in $.P_hasMore to resolve the issue  (P_ indicate the parent level).  Now, the API complete in an instant...just like you said.

 

Thanks again!

--Allan

View solution in original post

2 Replies 2
WendyGoh
Solution
HubSpot Employee
HubSpot Employee

Is there a way to speed up the Email Event get campaign IDs API?

SOLVE

Hey @Benchmark_achen,

 

Have you tried setting a limit and loop through the results based on the hasMore and offset value? On my end, I have tried using the Get campaign IDs sorted by recent activity for a portal | Email Events API to retrieve all campaign IDs on portal 563xxxx and set a limit of 100 e.g.

 

https://api.hubspot.com/email/public/v1/campaigns?hapikey={{hapikey}}&limit=100

 

The response returned was pretty instant. In this case, would you mind clarifying how long it took for you when you run the two endpoints?

Benchmark_achen
Solution
Participant

Is there a way to speed up the Email Event get campaign IDs API?

SOLVE

Thank you @WendyGoh !

 

Based on your response and the fact that I wasn't able to get any of these two APIs to finish during my testing (I stopped them after a few hours), I finally realized that there must have something to do with stop indicator.  I use ZappySys JSON Source SSIS component to run these APIs.  In the component, I set the Array Filter to $.campaign which is one level down from the parent.  But, the hasMore indiciator is at the parent level.  Therefore, when I use the default $.hasMore = false to stop the execution, it has no effect.  I have to manually type in $.P_hasMore to resolve the issue  (P_ indicate the parent level).  Now, the API complete in an instant...just like you said.

 

Thanks again!

--Allan