HTTP Actions Flashcards
GET
GET is an HTTP method used to request data from a specified resource without modifying it.
Example - A browser sends a GET request to retrieve a webpage’s content, such as GET /home.
POST
POST is an HTTP method used to send data to a server to create or update a resource.
Example - A user submits a form to register on a website, sending a POST request with user details like name and email.
PUT
PUT is an HTTP method used to update or replace an existing resource with new data.
Example - A user updates their profile picture by sending a PUT request with the new image to /profile/picture.
HttpResponseResult
HttpResponseResult is an object that encapsulates the outcome of an HTTP request, including status code, headers, and response body.
Example - A HttpResponseResult for a successful request might include a 200 status code and the requested data in the response body.
Void
Void refers to an HTTP response with no content, typically used for actions where the server does not need to return data.
Example - A DELETE request that removes a resource may return a 204 No Content status, indicating success with no additional data.
HttpResponseMessage
HttpResponseMessage represents the response message sent from a server, including status code, headers, and body content.
Example - In a web API, a HttpResponseMessage might contain a 404 status code and an error message if a requested resource is not found.
IHttpActionResult
IHttpActionResult is an interface in ASP.NET Web API that represents the result of an action method, providing a consistent way to return HTTP responses.
Example - A method might return IHttpActionResult like Ok() for a successful response or NotFound() for a 404 error.