The Solid Platform supports idempotency to help prevent you from accidentally calling the same API call twice.
An idempotency key uniquely identifies each API request. You need to pass the idempotency key in the header (sd-idempotency-key) so that the Solid platform can identify the API request. This key should be unique, preferably an internal UUID that you store on your database.
- curl --request GET <base_url>/v1/person \
- --header 'Content-Type: application/json' \
- --header 'sd-api-key: sd_test_34477ggh88' \
- --header 'sd-idempotency-key: 9c91bbca-67a0-11ec-90d6-0242ac120003' \
- --header 'sd-person-id: per-bace1330-8478-4963-9ae8-e06a478228a1' \
Idempotent requests are optional, as in, you can make API calls without an idempotency key. All Solid API POST (Create calls) and PATCH (Update calls) support idempotency. An idempotency key sent for any other types of requests (GET, DELETE, etc.) will be ignored and not be saved.
Idempotency can be helpful if you are instructing us to move money, create a person or a business, or create a card.
- if a POST or a PATCH fails due to a network issue, you can retry the request with the same idempotency key to guarantee that it was executed only once.
- when a successful request is made with an idempotency key, we will save the result of that request.
- the Solid platform will respond with the original response object if you issue a new request with the same idempotency key.