8 views
Well, if we send several GET requests, we'll get the same response each time. What if we send several POST requests?
Asked at
AI answer
Repeated GET requests to the same URL usually return a representation of the same resource, provided the data hasn’t changed and the requests are made under the same conditions. GET is considered safe and idempotent: repeating the request should not change the server’s state.
POST is not idempotent by default. Several identical POST requests may create multiple resources or perform an action multiple times, so the responses may differ. If a retry after a timeout must not result in a duplicate operation, the server needs protection against retries, such as an idempotency key (Idempotency-Key) that stores the result of the first request. Behavior also depends on the API implementation.