Best Practices for querying AnyRoad APIs | AnyRoad Help Center

Best Practices for Querying AnyRoad APIs

To ensure optimal performance and a reliable integration experience when using AnyRoad APIs, we recommend the following best practices for polling and querying data.

Polling Strategy: Favor Small, Frequent Increments

Rather than querying large historical data sets over extensive date ranges (e.g., six months or more), we strongly recommend that integrations retrieve data in smaller, incremental time windows.

This approach not only improves the responsiveness of your integration but also reduces load on your systems and ours.

Frequency Recommendations

Minimize Full History Requests

Full historical data pulls should be reserved for exceptional circumstances, such as initial data migrations or re-synchronizations after an outage. If a full export is necessary, consider batching the request into multiple smaller queries segmented by date ranges to reduce server load and improve reliability.

Leverage Filtering Parameters

Most AnyRoad API endpoints support filtering parameters, like date ranges, requesting only records that have been updated, etc. Using these filters ensures that your queries are efficient and focused only on newly relevant data. By utilizing these filters, your integration minimizes unnecessary data transfer and processing.

Understand API Data Latency

Please note that some APIs, such as the Bookings API, may introduce a small natural delay before newly created or updated records become available. Polling at high frequency will not bypass this latency and may result in redundant requests if not properly accounted for.

Webhooks

AnyRoad has webhook-based integrations, which will offer customers a more efficient, event-driven alternative to polling.

We encourage customers with high-frequency or near-real-time needs to consider migrating to webhooks once available.

Summary

Good Practice Poor Practice
Polling small time windows Querying large six-month date ranges
Using filters Requesting full data set repeatedly
Scheduled polling once per hour/day for large unfiltered datasets Constant polling without data change logic, or switching to webhooks for frequent data needs