Client Methods

A client request method is a command or request that a web client issues to a server. You can think of the method as the declaration of the client’s intentions. There are exceptions, of course, but here are some generalizations:

  • You can think of a GET request as meaning that you just want to retrieve a resource on the server. This resource could be the contents of a static file or invoke a program that generates data.

  • A HEAD request means that you just want some information about the document, but don’t need the document itself.

  • A POST request says that you’re providing some information of your own (generally used for fill-in forms). This typically changes the state of the server in some way. For example, it could create a record in a database.

  • PUT is used to provide a new or replacement document to be stored on the server.

  • DELETE is used to remove a document on the server.

  • TRACE asks that proxies declare themselves in the headers, so the client can learn the path that the document took (and thus determine where something might have been garbled or lost). This is used for protocol debugging purposes.

  • OPTIONS is used when the client wants to know what other methods can be used for that document (or for the server at large).

  • CONNECT is used when a client needs to talk to a HTTPS server through a proxy server.

Other HTTP methods that you may see (LINK, UNLINK, and PATCH) are less clearly defined.

Get HTTP Pocket Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.