APIs & Integrations

developer473829
Member

Reduce Api Call Requests.

Hello, I am looking to reduce the number of times that I call on the hubspot api to retrieve email data.

 

Goal: I would like to display emails' subject lines and clicks performance somewhere else.

 

Current Approach: I am currently calling the endpoint:

 

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

 

From here I get a list of the ids for each email sent out 

 

Then I am iterating through and make separate calls to the same endpoint: 

 

https://api.hubapi.com/email/public/v1/campaigns/{id} 

 

 

You can see where the issue comes in. If I want to display this information then every time the page refreshes it makes (internal call + per email = total calls) a lot of calls. 

 

This can be mitigated by storing the data in a separate place but then the information won't be the newest.

 

Is there a better way to get the subject line and clicks for each email without making soo many calls?

3 Replies 3
tominal
Guide | Partner
Guide | Partner

Reduce Api Call Requests.

Hey @developer473829,

 

I would highly recommend that you store the data as a sort of cache and then display on the page that the data will be updated in "x minutes". Performing live calls per user introduces more issues. There isn't anything that HubSpot provides that will make your life easier if your requirement is perfectly live data.

 

In the background, your system can be pinging the HubSpot API at a more healthy rate while also keeping rate limiting in mind.

 

Hope that helps!


Thomas Johnson
Community Champion


Kahu Software LLC
A Texan HubSpot consulting firm
https://kahusoftware.com
Jaycee_Lewis
Community Manager
Community Manager

Reduce Api Call Requests.

You rock, @tominal 🙌

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

Jaycee_Lewis
Community Manager
Community Manager

Reduce Api Call Requests.

Hi, @developer473829 👋 To confirm, there isn't a batch endpoint for what you are after. Hey, @tominal @ChrisoKlepke @weiliang_lee have you tackled anything similar?

 

Thank you! —Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot