HTTP Methods in a RESTful API


Representational state transfer (REST) or RESTful web services are one way of providing interoperability between computer systems on the internet.

Web service APIs that adhere to the REST architectural constraints are called RESTful APIs. HTTP-based RESTful APIs are defined with the following aspects:

  • base URL, such as http://api.example.com/resources/
  • an internet media type that defines state transition data elements (e.g., Atom, microformats, application/vnd.collection+json,:91–99 etc.) The current representation tells the client how to compose requests for transitions to all the next available application states. This could be as simple as a URL or as complex as a java applet.
  • standard HTTP methods (e.g., OPTIONS, GET, PUT, POST, and DELETE)
GET
Used to obtain a resource, query a list of resources, and also to query read only information on a resource.
POST
Used to create a resource.
DELETE
Used to delete the resource.
PUT
Used to create a resource, or overwrite it, while you specify the resources URL.

Leave a comment

Your email address will not be published. Required fields are marked *