Archived topic — some details may be out of date.
Mock servers built from saved collection examples are still supported. Postman now also has code-based mocks: JavaScript request handlers plus aconfig.yaml, stored as files in your Git repository, which you can run locally or deploy. Create one in the app, or use the Postman CLI to generate one from an OpenAPI spec, collection or dataset (postman mock generate) and run it (postman mock run). See About mocks and Create a mock.
Working with an AI coding agent? The Postman plugin can build and run mocks for you.
For current help, see the Postman docs, try the free Postman tools (no account needed), or join us on Discord.
Hello,
I orienting what mock server to use and I have a question about the ability of Postman mock server to give API responses in specific order.
In my specific scenario I want to mock one and the same API request with two different responses in a sequential order (and is aligned with order of test execution).
The request header and body is in both calls exactly the same (and returns both 200) and I don’t have control to adjust request because the request is coming from the application itself which I don’t control.
I only am able to replace the url of the actual service provider to a mock host url.
For example:
GET https://xxxx.mock.pstmn.io/getOverview
first request → response-1 (returns an overview)
second request → response-2 (returns an empty overview because data obj is null)
Is this possible to achieve with Postman?
Thanks in advance.