DEV Community

Cover image for How to Test APIs on Mobile using API Tester
Chris Achinga
Chris Achinga

Posted on

How to Test APIs on Mobile using API Tester

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.

API Tester Application

Prerequisites

  1. API TESTER Mobile Application
  2. Ready to Use API endpoints

The API TESTER application is freely available for the following devices:

This article will use demo API endpoints from JSONPlaceholder, which offers free fake REST API.

https://jsonplaceholder.typicode.com/

We will use two endpoints:

https://jsonplaceholder.typicode.com/posts
https://jsonplaceholder.typicode.com/todos
Enter fullscreen mode Exit fullscreen mode

On a mobile device, open up the API Tester application:

Openning 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.

create a new get request

GET Request

Create a new GET request by tapping on the GET button:

get reqest

Give the request a name and paste in any of the API endpoints:

https://jsonplaceholder.typicode.com/posts
https://jsonplaceholder.typicode.com/todos
Enter fullscreen mode Exit fullscreen mode

Getting All Todos:

Paste in the endpoint: https://jsonplaceholder.typicode.com/todos and tap the blue play button on the top right.


results

The response:

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.

content type

The next step is to update the headers:

Content-Type application/json; charset=UTF-8
Enter fullscreen mode Exit fullscreen mode

json

To add the data to send, we head up to the Body section under the Raw tab and tap on post data

alt

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"
}
Enter fullscreen mode Exit fullscreen mode

data format

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

gig

aha

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.

Resources

API Tester Guides

Top comments (0)