- What mock API is?
- Benefits of Mock APIs
- Postman Mock Server
- Comparison Table
What mock API is?
Sometimes called a fake API, A Mock API is when you build an API that returns the desired data. Still, it is not your actual API, and it all has been simulated for some use cases.
The Mock API can help you throughout your development process and increase your team’s development pace.
The Mock API will have the same schema you have for the actual API, such as the information in your request (necessary headers, required body, or query params) and information you will get in the response (it will provide you with the exact data structure you may have in your real API for the response of your request).
You can run your mock server on your local machine, or you can run it on a server. In addition, you can choose to publish them on the Internet or publish it within the company you are working for.
Benefits of Mock APIs
Usually, front-end and mobile developers need a working API to start the integration. The team leader would probably prefer while the back-end developers are busy designing and developing an API; simultaneously, the front-end or mobile developers can carry out their work.
But what if the back-end developers are not ahead of the other developers? Front-end and mobile developers would be blocked, and the project would slow down. So here comes the first and most probably the best benefit of Mock APIs:
Mock APIs unblock front-end and mobile developers while back-end developers build the actual API.
Since a fake API will provide precisely the actual API’s data, the front-end and mobile developers can carry on their work without worrying. In contrast, the back-end developer develops the actual API. Once the API is ready, the front-end and mobile developers can switch from Mock API to the actual API.
Another benefit of using a Mock API is that the API will be tested for its correct data schema since both front-end and back-end developers are working simultaneously. The front-end developers can notify the back-end developers if the API does not provide the expected data structure while developing it, saving a ton of time.
Validating data schema with Mock APIs become easier. Front-end and mobile developers can give early feedback to back-end developers.
Informing the back-end developers about the possible problems while they are still working on it and are focused on the matter will reduce the distractions cost of the team. In addition, they are focused on the current API, and they are entirely aware of its structure and can change it if necessary for a shorter time than changing it days or weeks later it has been implemented.
Early feedbacks help back-end developers to apply changes faster.
Saving time and energy is why mock APIs are widely used and popular.
In summary, the benefits of mock API are:
- Frontend mobile and back-end developers can work simultaneously
- Fast feedback loop
- Finding issues early and fast
- Developing tests and APIs simultaneously
Now that we are familiar with Mock API and its benefits, let’s check the top 7 Mock APIs available.
website: beeceptor.com | Offers free & paid plans
Beeceptor, a powerful mock API tool
Beeceptor is one of the most straightforward tools available in the market for making fake API. Beeceptor’s free version has a request per day limitation, while by getting the paid plans, you can send more requests/day plus some excellent features like a private dashboard.
We call Beeceptor an easy-to-work tool because Beeceptor requires no code for utilization. You can inspect HTTP traffic and check the request’s payload and headers. By building a Mock API, you can set your desired response if your API server is not working. By default, Beeceptor supports CORS and accepts all origins, which can come in handy.
Beeceptor comes with Proxy mode, which you can benefit from by bypassing all of your APIs through it, inspecting their traffic, mocking a few requests that you want, and then forwarding the rest of them to the original API.
Beeceptor allows you to set higher latencies to simulate users with slower internet connections. One of the primary differences between Beeceptor and other mock API tools that makes it exceptional is that Beeceptor supports A/B testing without the need for redeploying your application or complex configuration.
Postman Mock Server
website: postman.com | Offers free & paid plans
Among many features, Postman offers Mock servers to create fake API
Postman is an API Client application that provides us with many features, including API testing which we have covered in our Postman API testing article. One of them is the mock server. You need a Postman account to work with Postman Mock Servers.
One of the key features about Postman is that Postman mock Servers are hosted on Postman Cloud, which makes it accessible to use from anywhere. Furthermore, like Beeceptor, you can also simulate network latencies. Unfortunately, the free version of Postman’s mock server has a request limitation.
Website: stoplight.io | Offers free & paid plans
Stoplight makes building fake Restful APIs easy
With Stoplight, you can run your mock APIs faster than ever. In addition, you can generate your custom JSON schema for responses.
The Stoplight is built upon Prism, a popular Open-source tool. As a result, you can quickly turn any Open API 2, Open API 3, and Postman Collection file into an API server with mocking, transformations, and validations. As demonstrated in the above screenshot, Stoplight offers a way to build fake Rest API endpoints with different http methods.
In the free version of Stoplight, you can implement your mock APIs and generate documentation for them. Under the enterprise version, you can access its version control system, Collaborative API Design, and create mock API for different projects without facing any limit.
Stoplight offers an intuitive interface, so we are talking about a high-quality UI/UX design for the application.
Finally, excellent integration with most version control systems like GitHub, GitLab, and Azure DevOps, makes it even easier and more delightful to use.
website: mocky.io | Offers free & paid plans
Mocky, a tool for building mock servers
Their official website describes Mocky as the following:
The world easiest & fastest tool belts to mock your APIs
Mocky is a web application, making it smaller, cleaner, and easier to work with. Mocky is also completely free to use, and it has no advertisement, limitation, or anything like that. You can find its GitHub repository here.
If you want a handy tool to implement Mock APIs as fast as possible, Mocky is an excellent choice, and it can even be used for educational purposes. However, it might not be a good choice for enterprise, large-scale applications with tons of APIs and collections.
website: mockoon.com | Free & Open-source
Mockoon, a free mock API tool
If you wish to work with free and open-source solutions, Mockoon is another available option. Mockoon can help you with implementing your Mock APIs for REST APIs.
Unlike the rest of this article’s list, Mockoon is a downloadable program that you can set up unlimited routes and environments to mock your APIs.
Mockoon offers a great set of tools for organizing your projects into different environments; you can count on it for enterprise and large-scale projects. That is a significant advantage of Mockoon to the other solutions.
Although Mockoon has a friendly GUI to work with, it also provides you with a CLI for developers that prefer not to leave the keyboard! The CLI will indeed save to save a tremendous amount of time of yours.
Website: mocki.io | Available to paid plans only
Mocki, a premium fake API tool
Mocki comes with a seven days free trial once you create an account. If you want to get premium features such as integration with GitHub, Unlimited requests, better support, and a monitoring dashboard for your APIs, you need to pay $10 per month.
You can start working with Mocki by installing the NPM package and creating a configuration file for your project. In addition, Mocki’s has friendly and straightforward documentation on its website, from which you can get started.
Setting network delay, faking response body, sending conditional responses, and even sending random data as a response are all the features Mocki brings to the table.
With the help of Mocki, you can remove dependencies to external services as it is doing all the work; designing your APIs, simulating errors scenarios, and serving static responses can all be done using Mocki.
Website: mockapi.io | Offers free & paid plans
MockAPI, a tool for creating mock APIs and severs
MockAPI is probably the most minimal solution you will happen to run into. It is a tool that helps you quickly mock up APIs, generate custom data, and perform operations using a RESTful interface.
MockAPI is meant to be used as a prototyping/testing/learning tool.
It comes with a free and paid plan (which you can pay $5 monthly or $35 annually). The free version limits you to only one project and four fake REST API endpoints. However, the paid version provides you with 20 different projects; you can have up to 50 fake REST API endpoints in each of them.
MockAPI can help you quickly create your resources and edit their relations. In addition, MockAPI helps you to generate fake data using
faker.js. Finally, you can add your team members and collaborate with them.
|Free Plan||Paid Plan(s)||Cloud Integration||CLI|
|Postman Mock Server||Yes||Basic: $15/Month Professional: $36/Month Enterprise: $99/Year||Available||Available|
|Stoplight||Yes||Starter: $99/Month Professional: $399/Month||Available||Not Available|
|Mocky||Yes||Not Available||Not Available||Not Available|
|Mock API||Yes||Premium: $5/Month||Available||Not Available|
What is the primary use case of mock APIs?
Having a simulated version of your real APIs can help your team develop your project faster errors efficiently, and that is when mock APIs comes in handy.
Are there any Open-Source and free solutions for mock API?
Yes, Mocky and Mockoon are both completely free and open-source that you can use in your project.
Can we simulate a slow internet connection using mock API tools?
Yes, many of the available tools provide you with a feature to slow down your internet connection on purpose.