Configure Your HTTP Request Sampler
You can configure your HTTP Request as a POST request just like in the image below.
Changing the method will simply do the trick. After that, we need to choose a service from reqres.in, so let’s open the website.
When you scroll down a bit, you’ll see a POST request with the name of “REGISTER – SUCCESSFUL”. If you click on the request, you can see the example request & response couple for a successful Register POST Request.
To make a successful /api/register call, your request should be like in the picture above. And before filling the body data, we need to configure the server’s name and path for our request on JMeter. So, let’s go back to JMeter.
We know that our base URL is https://reqres.in, so we should take the HTTPS part as our protocol and the rest should be our server’s name. 443 is the standard port number for secure transfers in HTTPS traffic. And thanks to reqres.in, we know that our Register request will be sent to /api/register path.
Attention: Since this website serves as a dummy API platform, no advanced Header manipulation or usage is needed. But in real scenarios, a request is usually sent with a Header part that contains different keys.
To add Header to your HTTP Request, just click on the element by following this path: “Right click on HTTP Request” -> Add -> Config Element -> HTTP Header Manager. After that, you’ll see that your header manager is added into your request. Let’s click on that and add some Header keys.
As you can see, we added some Header keys for our HTTP Request Sampler. Content-Type: application/json indicates that the request body format will be JSON. Accept: application/json key allows you to ask the server a JSON format.
The other two keys are also very popular as well. Now let’s continue with preparing our body data.
Body data for a POST request contains the information that will be sent to the server. And for our /api/register service, we need to add email and password keys to our body data. So, let’s do that.
And as you can see, we added body data to our HTTP Request, according to API documentation provided by reqres.in. You can also add these body data keys as parameters, it’s up to you. But don’t change the email and password values, since this is an example dummy service.