HTTP tutorial - Methods GET, POST, PUT

By means of so-called HTTP methods, various actions such as the creation, modification, retrieval and deletion of data can be carried out. The method is always part of the request and not of the response (answer from the server).

The following HTTP methods are directly supported.


Method

Function

Description

GET

Retrieving data without a body.

This method is used to send a request from the client to the server, which then receives a response.

If, for example, a URL is entered in the address bar, the browser executes a GET request to the server. As a response, the client receives, for example, an HTML document (the web page) back from the server.

Please note that this method is potentially unsafe, as any user data, such as XML or JSON, is always sent plainly in the query by means of parameters.

POST

Transferring data in the body.

In direct comparison to the GET method, the server expects the data in the body.

In a POST request, the data can be linked with each other on the server side, so internal states and responses can vary for each individual request, even if the data is the same each time.

When transmitting an XML file in a POST request, the response from the server also comes back as XML (SOAP).

The POST method is not only more secure, but also suitable for complex operations via parameters, e.g. to perform calculations/modifications with data.

PUT

Transferring data in the body.

In contrast to the POST method, you will always receive the same response for each PUT request that transfers the same data. This property is described as idempotent.

The server returns 204 as the status code.

The PUT method is used when the data is to be stored in a location (directory, server, etc.).

PATCH

Updating data.

The method PATCH delivers the same result as PUT. The main focus here is on updating the individual components of a data set, analogous to an UPDATE in SQL.

DELETE

Deleting data.

Analogous to the GET/PUT/PATCH methods, this method is used to delete the resource.

HEAD

Querying of content size or header, no body.

By means of the HEAD method, instead of the complete content, which would be returned via a GET request, only the metadata of the header, such as the modification date or size of a file, is delivered. Based on the metadata, you can now decide whether the complete file should be loaded afterwards or not.

This way, you can find out in advance how large the file of a Hollywood blockbuster is, for example, and whether changes have been made on the server side before loading it.

Note: All of the above methods can be used for both incoming and outgoing requests. Please note that on the input side, the data is received using the GET method. The methods are not functional for incoming data.

The extent to which data transferred in the body with the help of the POST, PUT or UPDATE methods is processed, must be decided in the profile itself. The methods play a role especially with REST APIs.

The situation is different with data that is transferred to external interfaces. Please refer to the respective documentation of the API as to which and how the method should be used.