message:
Status codes
Empty results are not errors
Search terms with no match, and reverse lookups over unmapped ground, both return200 with
an empty data array. This is the most common source of “the API is broken” reports.
Rate limiting
When an account exhausts its monthly usage credit, requests fail until the credit resets. Retry with exponential backoff and a jitter, rather than a fixed interval — a fleet of clients retrying on the same schedule re-creates the spike that tripped the limit.400, 401, 403 or 404 — the request is wrong, and repeating it only
consumes credit.
Reducing avoidable failures
Debounce autocomplete input
Debounce autocomplete input
A request per keystroke is the fastest way to burn through your credit. Wait ~300 ms after the
user stops typing, and cancel in-flight requests that have been superseded.
Cache what does not change
Cache what does not change
Place details for a fixed location are stable. Caching them within the limits set out in
Pricing and limits cuts usage substantially.
Keep the token off the client where you can
Keep the token off the client where you can
A token embedded in a shipped app can be extracted and used by others, and their traffic
counts against your credit. Restrict the token by domain, or proxy through your own
backend. See Authentication.