APIs & Integrations

mcmillansp
Member

API Server Error

Hello;

 

Been using this API for a couple months with no problem. I am attempting to sync a specific list with our offline database. So once a day or so I use the lists API to grab everybody. This has been working fine but for the past week or so it's been randomly (but consistently failing) returning a 500 Server Error. If I cut and past the url that failed in a browser it pulls down the records. And it fails inconsistently. Sometimes after pulling a few thousand, sometimes after 10,000, etc. Never in the same spot. Is it just timing out?

 

0 Upvotes
4 Replies 4
cbarley
HubSpot Alumni
HubSpot Alumni

API Server Error

Hi @mcmillansp , over the past few days there have been some lag times with our CRM that also affected our APIs. That said, these 500 errors are almost always transient delays somewhere in the stack. In theory, you should always be retrying these requests; I'd be willing to bet that'd resolve the vast majority of the issues you're facing. Implementing some retry logic would be beneficial to your integration. A certain level of 500 errors is expected in a large application like ours. Are you still seeing errors like this? How often (if you can approximate the number of calls between errors) are you seeing this? 

0 Upvotes
mcmillansp
Member

API Server Error

Hello Connor. Thanks for the feedback. Yes - that is what I have done. I am now trapping for and retrying 500 server errors and my code is now working now. Albiet much slower. What I find/found very interesting is that we've been using this API for a couple months for this customer (and have been using the HS API's for another customer for years) and have never had this type of issue. I agree/concur that they are to be expected. It just seemed to be a sudden and much more prevalent increase recently on this one process.

 

I am not counting/tracking the number of retries in the loop to get each list (there's about 35,000 in each list and I am grabbing 100 per call). But since it seems much slower i am guessing I am having to do a decent number of retries.

 

Thanks for the feedback.

 

0 Upvotes
cbarley
HubSpot Alumni
HubSpot Alumni

API Server Error

hmm that is interesting, thanks for clarifying. Do you have secondly rate limits applied? Which endpoints are you primarily hitting?

0 Upvotes
mcmillansp
Member

API Server Error

Hi;

 

The one giving me trouble is:

 

https://api.hubapi.com/contacts/v1/lists/" & listID & "/contacts/all?hapikey="

 

And it really only starting within the past 2 weeks. I also used the contacta API's quite a bit.

 

So it is definitely something strange and recent and almost seems to be isolated to this API and this portal.  We/I have credentials for 4 portals. 3 for one individual customer and 1 for this other customer. 

 

I am not sure what secondly rate limit means. In this particular case - when I was getting the sporadic error I was pausing the API call 3 to 5 seconds between each call. I would grab 100 customers from within a list, process locally, then wait - and initiate another call. Even if it worked - 3 to 5 seconds between calls to pull 30,000 + records would have taken a long time.

 

Still got errors. So strange.

 

One other point - I am pulling only specific fields/properties. Instead of bringing down tons of data - only getting name, email, zip code - a much shorter record. In theory that should work better/more efficient. But maybe hitting the api with a modified select causes this issue?

 

Maybe I will try without selecting specific properties.

 

 

0 Upvotes