Are HTTP APIs with (almost) no methods that bad?
Suppose I have an HTTP API with two methods: read and write.
So I could do
POST url: /api/read
body:
<method>customers.list</method>
<args>
<area_code>90210</area_code>
</args>
POST would be the method for both read and write. I know it's not RESTful, but I can update it on the fly on the server side without having to change the client's code, and even have a GET /api to retrieve all methods available, thus in a way have 开发者_StackOverflow中文版a mechanism to document the API on the client side.
What's so wrong with this approach, other than not being cache-able?
Thanks!
If something really simple solves your task - that's ok.
In your sample, I am not sure how common clients are going to send body in GET request.
精彩评论