Post requests are the most common types of requests that we perform on the internet and it is very useful in our day-to-day work life. These methods are those which are used to transfer data from a web browser to the server. In this article, I will teach you how to test post requests using API Tester mobile app.
Smartphones are becoming smarter all the time, and their use is increasing. Developers are now figuring out how to make their lives easier with smartphones. There are already many mobile apps available that eliminate the need for desktops/laptops for minor tasks. Termius, for example, is a popular SSH client that allows you to connect to servers while on the go from your mobile device.
API Tester is a mobile app that allows you to test APIs without requiring a PC. (Available on App Store, Play Store & AppGallery)
Main features of this app:
We are going to use JSONPlaceholder API for this tutorial. JSONPlaceholder is a free API for testing purposes.
Note: This API does not support file upload test requests or XML as a body type. As a result, only use the sections below as a guide.
This type of POST request is used when you have JSON data that needs to be sent to the server. For example, if you want to create an account on your website and store the user's name, email address, and password in their database, then this is the right type of test for you. You can also use this type of test if you want to update an existing record in a database or send feedback to your customer service team.
Sending JSON data to your server is done by sending a POST request with the Content-Type: application/json header. This tells the server that you’re sending JSON data and it should be processed accordingly.
This type of POST request is used when you have form data that needs to be sent as part of your request. For example, when someone makes a purchase on your website and wants to submit their credit card information through a form with name/value pairs such as "Name" = "John Smith", "Card Number" = "24653354689", etc., then this type of test will let you simulate that behavior accurately (assuming your form has those specific fields).
The POST request with form data is used when you need to send a form as part of your request. This type of test will allow you to simulate that behavior accurately (assuming your form has the appropriate fields).
When you need to upload a file as part of your request, this test will let you simulate that behavior accurately.
When you need to POST data encoded as application/x-www-form-urlencoded, then this type of test will let you simulate that behavior accurately. This is common when sending data from a form on an HTML page or other client-side technology.
This is similar to FormData except that you cannot upload files and the data is URL encoded.
When you need to POST data encoded as XML, this test will let you simulate that behavior accurately.
This method can be used to test POST requests with binary file attachments. This is a good option if your request body requires a binary file. The disadvantages of this type are that you can only send one file per request and no other data can be sent with it.
Values are sometimes used repeatedly. For example, the same base URL in each request, API keys, and so on. What if we could create once and reuse these values elsewhere? Here is where global variables come into play. We can define variables once and then use them wherever they are needed.
Let's see how it works. Assume we use the same base URL in each request. This base URL can be saved in a global variable and later used in our requests.
baseURL
) and the value in the value field.
https://jsonplaceholder.typicode.com
with {{baseURL}}
.
API Tester is a great tool for testing API requests, as it can easily test every type of request that a desktop API tool could perform. In this article, we looked at different types of POST requests and how to run them through API Tester. If you find yourself making many POST requests to third-party APIs using cURL or collections from other API tools, there may be a better way to test your endpoints using API Tester.