Idempotent APIs: Avoid Duplicate Requests with Golang and Redis
Process:
First API Call
Make a POST request to the "shipping/order" API endpoint.
The specified "order_id" is checked in the Redis. If it exists, the object is sent to the user.
if it doesn't exist, the service stores the new object in Postgres and Redis after 3 seconds (this 3 seconds delay is
deliberately used to demonstrate the process).
Second API Call
Make a POST request to the "shipping/order" API endpoint with the same "order_id" parameter.
The service responds and returns the object instantly.