HTTP protocol request mode and response code


1. HTTP request mode

HTTP request methods are proposed in version 1.0 and 1.1 respectively. In version 1.0, there are get, head and post. In version 1.1, put, delete, patch, options, trace and connect are added
http 1.0:

  • Get: get the information of the specified page and return the entity
  • Head: get the header information. There is no corresponding response entity
  • Post: used to submit a form and add new data. The data is included in the request body and used to create or modify a record

http 1.1:

  • Put: modify or replace an existing record.
  • Delete: delete a record.
  • Options: allows clients to view server performance.
  • Patch: it is a supplement to put request mode, allowing partial update of existing records.
  • TACE: it mainly tests or diagnoses requests.
  • Connect: reserved for the proxy server that can change the connection to pipeline mode.

2. HTTP response status code

  • 1 * *: represents that the request needs to continue
  • 2 * *: the request is successful
  • 3 * *: redirection, need further operation, and then complete the request
  • 4 * *: client error
  • 5 * *: server error
101: continue client should continue to request
102: switching protocol the server switches the protocol according to the request of the client.

200: OK, the request is successful. Generally used for get and post requests
201: created. A new resource was successfully requested and created
202: accepted, but not processed
203: non auth info unauthorized information request succeeded
204: no content. Server successfully processed
205: reset content
306: partial content. The server successfully processed some get requests
300: multiple choices
301: moved permanently
302: found temporary move
303: see other
400: bad request client request syntax error, the server can not understand
401: unauthorized request requires user authentication
402: payment required reserved for future use
403: the server understands the request of the requesting client, but refuses to execute the request
404: not found the server could not find the resource according to the client's request.
405: method not allowed the method requested by the client is prohibited
406: the not acceptable server cannot complete the request according to the content characteristics of the client request
500: internal server error. The service completed the request
501: not implemented server does not support the requested function and cannot complete the request
502: bad gateway received an invalid request from the remote server when trying to execute the request as a gateway or proxy server
503: service unavailable system overload, system maintenance
504: gateway time out gateway or proxy server to get results
505: the HTTP version not supported server does not support the HTTP protocol version