CONFIGURE MOCK SERVERS
Jan 25, 2024 Copy Link
Postman provides us a nice way to create Mock servers
to simulate the behavior of a real API server by accepting requests and returning responses. So, there are three ways including Mock Collection
, Mock Request
, and Mock Custom Request & Response
In case you already have a Collection
, follow the next simple steps:
1. Move the cursor over the collection to show three dots on the right side.
2. Choose the Mock collection
option then type an expressive name.
3. Click the Create Mock Server
button.
After the previous steps, Postman will provide you a URL
that you can use with any end-point
in your collection, and after sending the request you will be surprised to receive the same response that exists in your collection 🤯
The same previous steps you can use also with a just simple request or in case you do not have the Collection
nor the Request
you can create a Request with its response from scratch
as the following steps:
1. Click the Mock servers
in the right sidebar.
2. Click the plus button at the top of the panel.
3. Write your end-point in the Request URL
section (You can customize the Response Code
OPTIONALLY).
4. Write the response that will be returned to Front-end
in the Response Body
section.
FINALLY, you have a nice Mock server now 🚀
To dive into this tip, I recommend reading that Article.