Reputation: 10580
I am reading a Javascript book where it talks about web services but I find it hard to understand the following sentence as being a drawback of using REST (Representational State Transfer).
One of the biggest drawbacks to using REST is that some browsers support only GET and POST methods, whereas many firewalls allow passage of only GET and POST methods.
I don't really see how this is regarded as a drawback. English is not my 1st language so it could be just me finding it hard.
Can someone elaborate on this?
Upvotes: 9
Views: 7267
Reputation: 13297
Restful web service typically utilize many of the methods defined in the Http spec. So, Create methods use Http Post, Read methods use Http Get, Update methods Http Put, Delete methods use Http Delete. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html and Which HTTP methods match up to which CRUD methods?.
The concern raised in the book is that Put and Delete may not be usable through firewalls or in some browsers. I don't know if this is a valid concern. I think the Internet infrastructure today handles this stuff pretty well.
The Crud methods Stack Overflow article mentioned above includes a helpful comment:
And since PUT and DELETE aren't yet supported by web browsers, it's considered okay to "overload POST" by adding a query string argument like method=PUT or method=DELETE on the URI being POSTed
Upvotes: 2
Reputation: 1900
Well REST Web services uses the HTTP Request Methods: POST, GET, DELETE, PUT. So this means that the PUT and DELETE HTTP Request methods are not supported. It is a draw back but there are ways to get around it by manipulating the DTO's. This however will mean that you don't follow the full REST approach.
Upvotes: 1
Reputation: 262824
It is a drawback in that if your application relies on DELETE or PUT requests not every client or network configuration will support that, meaning that there will be situations where you may not be able to deploy it (without workarounds).
I am not sure if this remains a real problem, though, and it is easily solved by having some filter rewrite requests for clients that cannot issue proper DELETE or PUT.
Upvotes: 1
Reputation: 53565
REST supports PUT and DELETE methods as well as GET and POST - so if your app should run in a browser you're limited.
The convention is to use GET to retrieve information, POST to create new object/entity, PUT to update an existing object/entity and DELETE to delete...
Upvotes: 3