HTTP methods – REST APIs
HTTP methods, also known as verbs, define the type of action a client can perform on a resource in a RESTful API. Each method represents a specific operation that defines the endpoint’s intent on a resource. Here is a list of the most frequently used methods, what they are for, and their expected success status code:
Next, we explore the commonly used status codes.
- 1XX (informational) codes indicate that the request was received and the process is continuing, such as 100 Continue and 101 Switching Protocols.
- 2XX (successful) codes indicate that the request was received successfully.
- 3XX (redirection) codes indicate that the client must take further action to complete the redirection request.
- 4XX (client error) codes indicate an error on the client’s part, such as validation errors. The client sent an empty required field, for example.
- 5XX (server error) codes indicate that the server failed to fulfill an apparently valid request and that the client cannot do anything about it (retrying the request is not an option).
The following table explains some of the most common ones: