Delays on the front- or back-end make it difficult for dependent teams to complete their work efficiently. Postman’s mock servers can alleviate those delays in the development process.
Front-end developers can create a mock server to simulate each endpoint and its corresponding environment in a Postman Collection, before sending the actual request. Developers can view potential responses, without spinning up a back end.
Creating a mock example during the earliest phase of API development fosters clear communication among team members and aligns their expectations. As a result, all teams in the development process can work in parallel; and dependent teams experience fewer delays.
You can create a mock in several ways:
Mocks are accessible to the public by default. If you create a mock and specify that it is only to be available privately, Postman Pro and Enterprise users can share the underlying collection with the team or specific team members, and provide permissions to edit or view.
Note: This topic only covers how to create a mock with the New button and the Launch screen. To learn how to create a mock with the Postman app or the Postman API, click its link for detailed information.
Note: At the bottom, you can select “Show this window at launch” to indicate whether you want the Create New tab to display each time you open Postman.
Note: The number of calls made to mock servers might be limited by your Postman account. Check your usage limits.
In the Next steps tab, see a list of suggested next steps to maximize the effectiveness of your mock server.
The Create New tab appears by default when you launch Postman.
Note: At the bottom, you can select “Show this window at launch” to indicate whether you want the Create New tab to display each time you open Postman.
In addition to using the Postman app to make requests to mock endpoints, you also can make those requests in a browser.
A web browser makes a cross-origin HTTP request when it requests a resource from a domain, protocol, or port that’s different from its own.
For security reasons, cross-origin resource sharing (CORS) is a standard that defines a way in which a browser and server can interact securely. In this case, we are referring to how a web browser interacts with the mock endpoints hosted on the Postman server.
CORS is enabled for Postman mock servers. As a result, you can stub your web apps with mocked data using the mock endpoints. So development or production web apps can make requests to the Postman mock endpoint you just created and receive an example response.
Your Postman account gives you a limited number of free mock server calls per month.
You can check your usage limits in the Postman API or in the account usage page.