Using a mock server URL helps you test your API calls without needing the real server. It saves time and avoids errors when the real server is not ready.
0
0
Using mock server URL in Postman
Introduction
When the real API server is still being built but you want to start testing.
When you want to simulate different responses to check how your app handles them.
When you want to test your API calls offline or without network dependency.
When you want to share a predictable API response with your team for collaboration.
When you want to speed up testing by avoiding slow or unreliable real servers.
Syntax
Postman
https://<mock-server-id>.mock.pstmn.io/<endpoint>
The mock server URL starts with https:// and includes a unique mock server ID.
Replace <mock-server-id> with your mock server's unique ID.
Replace <endpoint> with the API path you want to test.
Examples
This URL calls the mock server's
/users endpoint.Postman
https://12345abcde.mock.pstmn.io/usersThis URL calls the mock server's
/orders/123 endpoint to get order details.Postman
https://67890fghij.mock.pstmn.io/orders/123
Sample Program
This is a simple GET request to a mock server URL for the /products endpoint. The mock server returns a fixed JSON response with product details.
Postman
GET https://12345abcde.mock.pstmn.io/products Headers: Content-Type: application/json Expected Response: { "id": "101", "name": "Coffee Mug", "price": 12.99 }
OutputSuccess
Important Notes
Always copy the mock server URL exactly from Postman to avoid errors.
You can customize mock responses in Postman to test different scenarios.
Mock servers do not execute real logic; they return predefined responses.
Summary
Mock server URLs let you test APIs without the real backend.
Use them when the real server is unavailable or for faster testing.
Mock URLs have a unique ID and endpoint path you must use correctly.