Photo by Simon Ray on Unsplash

Just Fake It: Mock API 101 for Android Developers

Abhilash Das
Dec 20, 2019 · 4 min read

Mocks come into play in different stages of the app development lifecycle. Let’s assume you have a separate team of front end and back end developer. When you start working on the app, if the API is not ready, then you are stuck in the middle of nowhere.

The best way to go ahead with development is to mock your API. Build your app from the expected response and when your backend API is ready, just replace it with the actual base URL. In addition to that, you can test all the backend scenarios without bothering your backend team.

There are various ways to mock an API. We are gonna discuss some of the options I personally use.

Mocky is a free service and you can mock your HTTP responses to test your REST API. You can set Status code, content-type, body and Custom headers in Advanced Mode. It’s easy to use and doesn't require any brainstorming.

There is one shortcoming though. It will break in Android pie devices and higher. It’ll throw (and even if you use https). Have you ever heard of ClearText the issue? If not then here is a great article regarding that. This error is because of that.

Mockable has also a simple UI to use. You can create a custom path for your API, Verb, Headers, Response status, content type, content-encoding, response body and response delay.

Wow!! So many customizations. But it comes at a price(literally). If you use the free version, then the mock server lasts for 24 hours (if you use a guest account) or 3 months of inactivity(if you create an account). If you go for the premium version, then you’ll get some nice features.

For most of us, it’s more than enough. But if you want little more than that, then this is the best option available out there.


Postman is a collaboration platform for API development. It also provides a nifty feature to create a mock server that we can use for our purpose. Creating a “Mock Server” is a 3 step process. Let’s see:

  1. Click on “New” and select “Mock Server”.
step 1

2. Define your desired request path, response code, and request body.

3. Name your mock server and click on next. To make your mock server private you need Postman API key.

step 3

Voila. Now your mock server is ready. Note down the base URL of your mock server. In my case, it is Now use this mock server URL to test your app.


One biggest advantage of using Postman is you can change the response dynamically and it’ll start reflecting immediately to the same endpoint, which is not the case for the previous two options.

You can visit this link for further guidance.

Hope this helps you develop building the next big thing. If you like this article, then show your love by giving a 👏🏼.

Geek Culture

Proud to geek out.

Sign up for Geek Culture Hits

By Geek Culture

Subscribe to receive top 10 most read stories of Geek Culture — delivered straight into your inbox, once a week. Take a look.

By signing up, you will create a Medium account if you don’t already have one. Review our Privacy Policy for more information about our privacy practices.

Check your inbox
Medium sent you an email at to complete your subscription.

Abhilash Das

Written by

Android Developer @ Cred

Geek Culture

A new tech publication by Start it up (

Abhilash Das

Written by

Android Developer @ Cred

Geek Culture

A new tech publication by Start it up (

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store