Idempotency Header

As a client to any API, you may be concentrating on a specific API endpoint and the documented request body and parameters. An important consideration though is looking for headers and other parameters that may be documented as being accepted across the entire API.

For instance, one very important header (which is not standardized) is an idempotency header. While RESTful APIs have conventions for dealing with idempotency, the practical reality is that many APIs today rely on an idempotency header, especially APIs involving payments or other forms of transactions. Each API also deals with idempotency slightly differently, but the general theory is that a request with the same idempotency header value should only be processed once. If the request was already processed, usually a cached response is returned. Some APIs require that the request body must be the same, so the specific details vary between APIs. See the PayPal documentation for examples.

It is easy to miss the general API details in the documentation. However, in order to have a successful API integration, it is critical to use parameters like the idempotency header when available.