Sobes.tech
Middle+

What HTTP method should be used for a cashback write-off button in REST API and why is GET not suitable?

sobes.tech AI

Answer from AI

For the cashback deduction button in REST API, the HTTP methods POST or PUT should be used, as this operation changes the state on the server — deducting funds from the user's balance.

The GET method is not suitable because it is intended only for retrieving data and should be idempotent and safe, meaning it does not change the server's state. Using GET to modify data violates REST principles and can lead to undesirable consequences, such as repeated deductions when refreshing the page.

What HTTP method should be used for a cashback… - sobes.tech