Sep 16, 2012 08:18 PM|GaryDean|LINK
I have a bunch of WCF SOAP services that serve my WP7 apps. They do all sorts of things but basically they take arguments and return results. It all works well.
Now I'm porting those apps to Android and there I must deal with REST instead of SOAP. So I'm using asp.net web api. and I plan to duplicate my SOAP services using http to send and receive the same arguments and results.
I'm going through a tutorial entitled "Creating a Web API that Supports CRUD Operations". Here it's all about GET, PUT, POST, DELETE. Now I know those are the basic http verbs. For instance, the following is the definition from the tutorial explaining
"The four main HTTP methods (GET, PUT, POST, and DELTETE) can be mapped to CRUD operations as follows:
•GET retrieves the representation of the resource at a specified URI. GET should have no side effects on the server.
•PUT updates a resource at a specified URI. PUT can also be used to create a new resource at a specified URI, if the server allows clients to specify new URIs. For this tutorial, the API will not support creation through PUT.
•POST creates a new resource. The server assigns the URI for the new object and returns this URI as part of the response message.
•DELETE deletes a resource at a specified URI."
I understand that the word "Get" or "put" affects the routing to the correct method but once in the method my logic can do anything it wants - right? I could have a method named "PutProducts" that computes the square root of and integer and returns it -
it doesn't put anything.
As long as my service methods can accept any imaginable input arguments and return any imaginable output data, what does it matter if it's a GET, PUT, POST, or Delete?
I don't get it.