I have been working with Infusionsoft PHP API for the last couple of weeks now and i did not have any issues with it. That was before i started synching a large number of contacts from the PHP website to Infusionsoft application. The first few thousand imports were fast but it would gradually start slowing down after that indicating that the API was rejecting some API calls which indeed turned out to be the case since IS API starts delaying requests once all of its 10k credits are consumed and then there is a risk of API throttling.
If you are unaware of the API throttling and the request credit system in IS, you can visit here for more details.
Now, when all the credits were consumed, i had to find a way around. Since i was importing contacts in the form of batches, i though of two ways to overcome this issues in my next import batch:
Adding a delay of 500ms before every API call:
This was every calls will be made after delay of 500ms which is exactly the time required to re-generate one credit. So, this method consumes as well as generates one request credit which stops API from delaying our requests.
So according to folks at Infusionsoft :
1 credit = 500ms idle API time (No API traffic)
10k credits = ~1.5 hours of idle API time (No API traffic)
Adding delay of 1.5 hours after every batch:
This method does the same but depending upon the no of API requests you are making, you can add this amount of interval after one batch import before moving to the next one. You must be wondering why 1.5 hours, right?
It’s 1.5 hours because it takes roughly 1.5 hours to regenerate 10k requests credits. Remember, the API needs to be in idle mode to regenerate credits(No calls).
As long as you are calling the API methods through a single thread, there will be no issues, other than of course request delays because of lack of available credits.
If the no of threads is increased from 1 to 2, the delay will be doubled for every call i.e. 1 second, that’s because the latency is divided among both threads by the app uniformly. This time will increase for every thread by 500ms. That is what we call API throttling.
Now, in Infusionsoft we can use as many threads as we need as long as we have credits, but requests start being rejected once the threads start getting throttled and maximum no of throttled threads are 4.
Latest posts by alexey (see all)
- Quick Facts About WooCommerce - April 25, 2018
- WordPress stuck on a “Too many redirects” error loop when using SSL - January 17, 2018
- Sails.js + Passport.js : req.user undefined - December 31, 2017