Overview

Idempotency in the context of a RESTful API means that it is safe for a client to repeatedly make the same API call with the same result every time. I.e. doing the exact POST request that will create an entity two times will only create the record once, yet returning the same response on all requests to the caller.

By default, this feature will not come into effect, unless explicitly specified by the caller by passing an idempotency_id in the namespace of the resource.

These resources support idempotency:

Making an Idempotent Request

Pass a random 32 character hyphenless GUID in the namespace of the entity to enable idempotency, as shown in the example below:

POST /address
Content-Type: application/json

{
  "address": {
    "idempotency_id": "c3a8adaa26daf36e02f3c672b69e3323",
    ...
  }
}

The random GUID must be generated by the client. For the next 7 days, a repetition of this very same request will return the exact same result as the first request and not create a new object.

When you re-use an idempotency id on a different resource, an error is returned:

[
  {
    "$severity": "error",
    "$dataCode": "IdempotencyResourceMismatch",
    "$message": "Entity type mismatch",
    "$source": ""
  }
]

Don’t use this feature for GET and DELETE request, as they are idempotent by definition.

Idempotency works for POST as well as PUT requests.

By its HTTP definition, PUT requests are idempotent. However, it is the nature of accounting that the modification of an object can lead to further actions. E.g. when a line item is added to a sales invoice, it will cause a new transaction to be recorded. Other side effects like the sending of an email can also be triggered. To avoid such behaviour, a client can use the idempotency feature on update calls.