Gateway errors
The gateway returns a JSON problem document:title for the human-readable reason and status for the HTTP status code.
Authentication and authorization
A missing token returns
400, not 401. This is unusual, and worth handling
explicitly if you are branching on status codes.WWW-Authenticate header distinguishes the two cases: error="invalid_request"
means nothing was sent, error="invalid_token" means what was sent is no longer
good. Both are worth retrying only after obtaining a fresh token.
Rate limiting
A429 means you have exceeded the request rate. If the response carries a
Retry-After header, wait that many seconds; the value is also interpolated into
title. Otherwise back off before retrying.
Service errors
Once a request is authenticated and authorized, the service handles it and returns its own status codes:
Some services return a body of the form:
Retrying safely
GET requests are safe to retry. For requests that create or modify something —
adding a cart line, checking out, creating a ROA — a 500 or a network timeout
leaves the outcome unknown. Re-read the resource to check whether the change
landed before retrying, rather than sending the same write twice.