Search code examples
restapi-designendpoint

Can't we use a GET to create a new resource in REST instead of a PUT?


I am a newbie to REST web services. I have been going through a tutorial, where it is described that

  1. GET is used to provide a read only access to a resource
  2. PUT is used to create a new resource
  3. DELETE is used to remove a resource
  4. POST is used to update/create a resource

and the list goes on.

So if we are passing the arguments/parameters to the service to process something, why cant we implement an update action using a GET or a delete action using a GET or POST. How is the service going to control an action that's going to happen in the back end ?


Solution

  • You can find lists of popular API's all over the place.

    https://webdam.com/blog/top-10-web-apis_bridging-todays-technology/ http://www.computersciencezone.org/50-most-useful-apis-for-developers/

    Think in terms of facebook: Get Feed, Put Status, Post New Profile Picture, Delete Comment, Patch Join Group.

    https://developers.facebook.com/docs/javascript/reference/FB.api