How to Test APIs on Mobile using API Tester
A quick guide on how you can test your APIs using a mobile Application
Imagine testing APIs using your mobile device, either iPhone or Android. All APIs, including REST, GraphQL, WebSocket, SOAP, JSON RPC, XML, HTTP, and HTTPS.
This article will show how we can test APIs on mobile devices using API TESTER.
Prerequisites
- API TESTER Mobile Application
- Ready to Use API endpoints
The API TESTER application is freely available for the following devices:
- iOS: Download Link
- Android: Download Link
- Huawei: Download Link
This article will use demo API endpoints from JSONPlaceholder, which offers free fake REST API.
We will use two endpoints:
https://jsonplaceholder.typicode.com/posts
https://jsonplaceholder.typicode.com/todos
On a mobile device, open up the API Tester application:
To get started, click on the Create new request
The next screen provides various options, from selecting the type of request, GET, POST, PUT, PATCH, DELETE, to importing APIs from external platforms like Postman.
GET Request
Create a new GET
request by tapping on the GET button:
Give the request a name and paste in any of the API endpoints:
https://jsonplaceholder.typicode.com/posts
https://jsonplaceholder.typicode.com/todos
Getting All Todos:
Paste in the endpoint: https://jsonplaceholder.typicode.com/todos
and tap the blue play button on the top right.
The response:
When testing APIs, we usually test for all Request methods. Next, we’ll look at how to test for Sending a POST request.
POST Request
To send a post request from API Tester mobile application, go to create a new request (+ icon) and select a POST
. We will use the same endpoint as GET
request:
https://jsonplaceholder.typicode.com/todos
To make a POST request, we will need to add a few options:
The first step is to update the Body
of the request. We will post data in JSON format, so tap on the Raw tab under the body section.
Ensure the Content-Type is set to application/json.
The next step is to update the headers:
Content-Type application/json; charset=UTF-8
To add the data to send, we head up to the Body section under the Raw tab and tap on post data
Paste in the JSON data:
{
"userId": 1,
"title": "a big one",
"body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"
}
Once that is done, tap on the blue play button on the top right of the application. If everything is properly done, the app returns a response with status code 201 (Created), and a new id created with the new object posted
Conclusion
This article has explained the processes of using the API Tester mobile applications to test for APIs using GET
and POST
methods using a free test API endpoint.