To improve the reliability and general accessibility of the LabStats API, we employ page limits, rate limits, and caching. Be aware of the following terms and limits as you call the API:
Page Limits
Many endpoints have the possibility of returning large amounts of data which, in some cases, would be too large to safely process at once. Using paging techniques you can still use the API to obtain large amounts of data in a safe manner. These endpoints have a Page Limit which refers to the maximum number of records which can be returned at one time. Each response from endpoints with page limits will include an “additional_pages” property which indicates if additional records are available. If the response was limited, you can then make additional requests to obtain the next set of records (the next page). Use the “last_id” property as the “after_id” parameter in the next query. The API Documentation identifies paged endpoints and their page sizes.
Endpoint Rate Limits
Some endpoints may have a rate limit which restricts the number of requests that can be made to that endpoint within a certain period of time. This requires you to spread your usage out so that it doesn’t become too taxing. The API Documentation identifies rate limited endpoints and their restrictions.
Follow these guidelines to ensure your use of the API is not excessive or wasteful:
- Only request data from the API that you actually need.
- Store results for reuse rather than making duplicate requests later.
- If you are requesting the same data continuously for the purpose of getting real-time updates, make sure your request interval isn’t unnecessarily short (for many scenarios, data that refreshes hourly would still be considered real-time and would be much less taxing on the API than requests every ten seconds).
Organizational Rate Limits
In addition to individualized endpoint rate limits, LabStats also imposes an Organizational Rate Limit which restricts the total number of requests that can be made to all endpoints within a certain period of time. As with individual endpoint rate limiting, this requires you to spread your usage out so that it doesn’t become too taxing. The current organizational rate limit is 250 requests per minute, however, this limit is subject to change.
Caching
Many endpoints employ caching to maintain proper operation of the API, but it also supports its use by a larger number of distributed users or applications and helps alleviate rate limiting restrictions. This is particularly helpful for use with mobile applications and websites. With this in mind, calling the same endpoint with the same parameters and filters multiple times within the caching period will yield the same cached result. As a general rule, endpoints providing real-time data will be cached for a shorter time while endpoints providing data that doesn’t change as often will be cached longer. The API Documentation identifies cached endpoints and their durations.
Related: LabStats API
API Documentation & Testing
Comprehensive API documentation is available which lists all available endpoints and provides information about their parameters, filters, caching details, rate limit restrictions, and expected responses. This API documentation can also be used to test your organization’s API directly.
To access this documentation and testing resource, use the appropriate link below based on your organization’s location:
North America: https://api.labstats.com
Australia, New Zealand, & Asia: https://sea-api.labstats.com
Europe: https://weu-api.labstats.com
Have questions? Contact support@labstats.com.