I was checking out the Stripe API documentation for the Update a Customer endpoint and noticed that it uses a POST request to update customer details. This seems a bit unusual to me since RESTful APIs usually use PUT for full updates and PATCH for partial updates. I'm curious—what reasons might Stripe have for choosing POST for this operation?
5 Answers
Sometimes, it's simply a matter of "because they can." There isn't always a deeper rationale behind these decisions beyond the fact that they're doing it their way.
I've heard security auditors raise concerns about using anything other than GET and POST for API calls. If Stripe has to work with government systems, they might have to adhere to these standards for security reasons. I’m not saying I fully agree with them, but they can have a big influence on API choices.
It's possible that Stripe's choice is just about maintaining compatibility, especially if their API has been around for a while and needs to support older integrations.
A lot of APIs don't strictly follow REST principles. Many just use GET for retrieving data and POST for changing it. Honestly, the other methods like PUT and PATCH can be useful for clarity, but many developers don't feel the need to enforce them. It's often more about practicality than adherence to technical rules.
It's interesting that you find it unconventional. Remember, API operations are fundamentally about formatted text. In the past, verbs weren't as important; POST was used extensively. Now, we often get caught up in following the rules too strictly but at the end of the day, it's just a name for an operation.
Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically