Tray Platform / Standard / Best Practices / API limits and queue management / Intro to managing API limits

Intro to managing API limits

  • On this page

When building Tray.io workflows, it is very likely that you will come across issues arising from the fact that certain operations in service connectors have API rate limits.

For example a particular service connector may have a limit of 100 calls per hour when you are trying to download records, or running a batch update operation.

Or you may be trying to add hundreds of rows to a Google Sheet, and you find that your Sheets add rows errors with the following response:

And if we look at

this page on the rate limits for Google Sheets API we see that the rate limit is 100 requests per 100 seconds per user.

So this means that if you are looping through and adding 100 records to a Google Sheet, if your workflow takes less than 100 seconds to do this, then you will receive the above error.

The solution here is to set up a system which controls the rate at which these calls are made. There are several options for doing this:

  • If you are not processing huge amounts of data, a standard apporach is to use the CSV Editor to store your records at account level. You can then set up a scheduled workflow to extract these records for processing using the Get Rows operation, at which point you can specify exactly how many rows are extracted for processing each time. See the tutorial in this section for guidance

  • The CSV Editor is likely to present problems if it is fed in the region of 20,000 rows (you may find duplicates and fragmented data appearing). In this case you can store the batches of data in a MySQL database instead. Storing data in MySQL also means you can perform extra validation, cleaning or enrichment tasks if need be (tutorial coming soon!)

  • Another option is to use the Tray.io Data Storage connector (tutorial coming soon!)

  • If you are wanting to manage queues of messages and API requests - e.g. you have a high rate of orders / purchases coming through from Shopify - a paid-for solution might be to use our Amazon SQS connector in conjunction with a scheduled trigger to control the rate at which you pull and delete messages from the queue (note that the CSV method above can be used as an alternative to paying for SQS).