Mockoon is a free cross-platform desktop application that takes API mocking to the next level. Mockoon offers a fast and easy-to-use interface and gives you complete control over your mock APIs with advanced functionality like a templating system, a proxy mode, and requests recording.
This tutorial will show you how to install the desktop mocking application and set up your first mock API.
Mockoon is available on the three major operating systems: Windows, macOS, and Linux. Visit the download section on the homepage to download the binary or installer for your operating system:
After downloading the installer, double click on the file to install Mockoon and follow the instructions. Now, open the application to start setting up your first mock API.
After launching the application for the first time, you will find a demo mock API, also called "environment" in Mockoon. You can keep it and build from here or create a new one. To create a new mock API, click on the "New environment" button. You will be prompted to save the environment's JSON file:
You can also rename the environment, as shown below:
The newly created mock API already includes a route on
/. You can modify it by setting up the method and path of your choice.
You can also create a new endpoint by clicking on the blue "plus" button at the top of the endpoint list:
You can further customize your endpoint by adding a custom header and the following sample body (which makes use of Mockoon's templating system):
You can create a more complex configuration by serving files or adding multiple responses triggered by rules.
The last step is to run your mock API. For this, click on the green "play" arrow in the header:
Your mock server is now available on
http://localhost:3000 (but also on
http://127.0.0.1 and all your local network adapters).
You can do a test call to the following URL
http://localhost:3000/tutorials using your favorite tool (here using Insomnia) and see the returned response:
Now that you know how to create a basic mock API, you can head over to the official documentation to explore the other functionalities like requests logging, partial API mocking with proxy mode, or the templating system.