Salesforce

API Best practice - How to adjust my API connection to fit Twinfield API limits?

Article Information
NL
Inhoud van het artikel
In this article we will outline the modifications that need to be made when communicating with our API considering the new limits on API calls.

API rate limit
A rate limit per minute will be imposed on the number of calls that can be made to our API per client and/or within an organization. When the rate limit has been reached, a 429 HTTP status code will be returned and the call will not be processed.

A limit to the maximum number of concurrent requests will also be introduced. If the concurrency limit is exceeded, a 429 HTTP status code will be returned and the call will not be processed.

How to handle the new API limits
A best practice when sending calls to our API is limiting the number of concurrent actions you perform per organization in Twinfield to one, and limit the number of concurrent actions across Twinfield.

This means that when you perform a handful of actions over several organizations, it is recommended to handle these per organization. For example, first updating the customers or suppliers in Twinfield. After that, you can then move on to the next action you want to perform, for example importing your sales or purchase transactions to an organization in Twinfield.

By purposefully limiting your actions per organization, your requests will be handled more efficiently.

Another best practice when using our API is spreading your work over a longer time. When starting all jobs at the same time for all organizations and companies, it will of course cause a spike in traffic for our API. This can in turn congest our API and cause all requests to be handled with delays and inefficiencies. By implementing a small delay in between calls and spreading your work over a longer time, your requests will be processed more efficiently.

When you do run into the 429-error, the handling of this error is important. For this reason, we will implement additional headers in our results to give you the information you need to manage the number of calls you are making to Twinfield:
  • X-RateLimit-Limit
  • X-RateLimit-Remaining
  • X-Concurrency-Limit
In case the request is rejected due to rate limiting, the following header will also be present:
Retry-AfterThe recommended retry interval in seconds after the specified call rate is exceeded.

Continuously causing 429-errors can cause unnecessary load on our servers. Therefore, we do expect proper handling of this error by Twinfield API integrations, and we do expect measures to be taken to limit the number of 429-errors caused.

More information?
API Best practices - API limits effective per October 1st 2024
API Best Practices - Introduction
detail information
31-1-2024 13:55
API Best practice - How to adjust my API connection to fit Twinfield API limits?
158
URL
API-Best-practices-How-to-adjust-my-API-connection-to-fit-Twinfield-API-limits

Powered by