Let's assume a service offers some funcionality that I can use like this:
GET /service/function?param1=value1¶m2=value2
Is it right to say that I can use it with a POST query?
POST /service/function { param1 : value1, param2 : value2 }
Are these two queries the same? Can I use the second variant in any case or the documentation should explicitly say that I can use both GET and POST queries?
POST is valid to use instead of GET if you have specific reasons for doing so and process it properly.
Learn why one type of processing request provides more security for your Web application in this expert tip. It's the age-old question: is the POST method better than the GET method for processing HTTP requests? The common response is always use POST.
Yes, you can make it work at least using WCF, it's bit different in MVC and Web API where you add attributes to methods like [GET] [POST] etc..
GET is less secure than POST because sent data is part of the URL. POST is a little safer than GET because the parameters are stored neither in the browser history nor in the web server logs.
I use POST body for anything non-trivial and line-of-business apps for these reasons:
BTW, I also put the fields to return in my POST body as I may not wish to expose my field names. Security is like an onion; it has many layers and makes us cry!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With