Last post Mar 28, 2018 02:25 PM by bruce (sqlwork.com)
Mar 22, 2018 10:46 AM|demoninside9|LINK
I am new to REST WEP APIs
One thing I noticed that if we can do every thing with POST method (by putting no of parameters regardless of insert update delete or select) why we need GET with parameters.
I am using only PUT to doing all CURD operations.
Could you please elaborate?
Mar 22, 2018 10:50 AM|mgebhard|LINK
HTTP GET sends data in the URL.
Mar 22, 2018 08:18 PM|PatriceSc|LINK
I guess you find obvious that SQL should have separate SELECT/INSERT/UPDATE/DELETE statements ;-)
Similarly each http "method" is intended for a particular purpose. See https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_methods
As, unlike SQL, you are writing what happens when a particular "http statement" is received by your server, you are not forced to adhere to any existing convention but your API will be likely harder to use by other developers.
Mar 23, 2018 01:37 AM|bruce (sqlwork.com)|LINK
you can code your api to use any methods.
but REST has verb conventions
GET - read resource
POST - create a new resource
PUT - update existing resource
DELETE - delete an existing resource
PATCH - make a partial update to a resource
there are also defined success/failure response codes
also there is the notion of idempotent. the GET, HEAD, PUT, DELETE verbs should have the same results if called more than once.
note: for webapi, the default routing is to ignore the action name, and only use the controller and verb to select an action.
Mar 24, 2018 08:59 AM|DA924|LINK
As I recall, I have seen Post being used when the data was being retrieved. I did wonder why at the time, but I never questioned anyone at the time why a Post was being done when getting data. And what a Post does to hide parms along with some other security
like issues being used when doing Post vs Get is why I guess.
Mar 28, 2018 02:25 PM|bruce (sqlwork.com)|LINK