Duplicate Requests
Discussion
Sometimes, especially with spotty internet connections, a client can make a request to the API that is serviced but for which a response is never received. For example, an application may submit an upvote but due to loss of connectivity never receive an acknowledgement.
A reasonable solution to poor networking is to retry unacknowledged requests a small number of times. However, many actions on the Stack Exchange network can only be performed once leading to "mysterious" failures if an retried request actually succeeded earlier.
Starting in v2.2, the API accepts a request_id
parameter along with every request. If a request_id is seen a second time in a small window
the request will be failed immediately with a duplicate_request
error. this means that any retried requests will fail sensibly, provided that
the same request_id
is used.
The exact window in which the API will recognize a duplicate request_id
is subject to change, but clients can assume the window is no
shorter than five minutes.