Default Http verbs in WebAPI

 

below are the list of default (by Convention ) supported Http verbs for a webAPI controller method

HTTP WEBAPI Description
GET HttpGet Get a resource from the server
POST HttpPost Add a new resource to the server
PUT HttpPut Update a resource to the server
DELETE HttpDelete Delete a resource on the server
OPTIONS HttpOptions as per RFC2616, “This method allows the client to determine the options and/or requirements associated with a resource, or the capabilities of a server, without implying a resource action or initiating a resource retrieval.”
HEAD HttpHead as per RFC2616, “The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response”
PATCH HttpPatch Partially update a resource on the server

for further reading on HTTP verbs you can refer for RFC2616 .

The webAPI controllers request handing are based on convention over the configuration principle. Lets understand it, If you are requesting a Get request to a webAPI controller , then any method that starts with Get prefix and a method named as Get is eligible to process this request.

Now here are one case, suppose you created a method named “AllEnrollmentNoList” which you want to be executed when someone issue a Get request, In this case you need to decorated your method with webAPI http attribute .

image

Hope you find this post useful ,Thanks for reading . 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s