POST Method

In this lesson, we will learn about the HTTP POST method.

We'll cover the following

What is the POST method?

The HTTP POST method sends data to the server to create a new resource.

The request body type is indicated by the Content-Type header field. Let’s take an example to understand more about it.

Let’s make a POST request for the given URL.

curl -iX POST -H "Content-Type: application/json" -d '{ "email": "eve.holt@reqres.in", "password": "pistol" }'  https://reqres.in/api/register
  • In the POST request above, ( -iX is for HTTP Method, -H is short for --header, -d for --data). The data is passed in the form of a JSON string.

Get hands-on with 1000+ tech skills courses.