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 with a URL that you can use with any endpoint 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 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 endpoint 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.

Share via

Filed in:

Tips Postman
Mahmoud Ramadan

Mahmoud Ramadan

Mahmoud is the creator of Digging Code and a contributor to Laravel since 2020.

Newly published

  • How to Enable Relationship Autoloading in Versions Before v12.8

    How to Enable Relationship Autol...

    FREE

  • Get your environment ready to welcome Laravel v12

    Get your environment ready to we...

    FREE

  • How to generate Arabic PDF using TCPDF

    How to generate Arabic PDF using...

    FREE