MockDraft automatically generates a Postman Collection from your OpenAPI specification. This makes it easy to test your mock API in Postman.
When the server is running, the Postman collection is available at:
http://localhost:3000/_postman/collection.json
1. Direct Browser Download: Open the URL in your browser, and it will download automatically:
http://localhost:3000/_postman/collection.json
2. Using curl:
curl -O http://localhost:3000/_postman/collection.json3. Using wget:
wget http://localhost:3000/_postman/collection.json- Open Postman
- Click Import button (top left)
- Choose one of these methods:
- Link: Paste
http://localhost:3000/_postman/collection.json - File: Upload the downloaded
collection.jsonfile - Raw text: Copy-paste the JSON content
- Link: Paste
- Click Import
The generated collection includes:
- GET, POST, PUT, DELETE, PATCH requests
- Proper HTTP methods and URLs
- Path parameters (converted from
{param}to:param)
- Request headers (Content-Type: application/json)
- Request body examples for POST/PUT/PATCH
- Generated from OpenAPI schema with x-faker support
- Example responses for successful requests (2xx)
- Status codes and descriptions
- Response body examples
The collection uses localhost and port values that can be easily changed in Postman:
- Protocol:
http - Host:
localhost - Port:
3000(or your custom port)
{
"info": {
"name": "User API",
"version": "1.0.0",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Get all users",
"request": {
"method": "GET",
"url": "http://localhost:3000/users"
},
"response": [
{
"name": "Example Response",
"code": 200,
"body": "[...]"
}
]
}
]
}- Auto-generated: No manual work needed
- Schema-aware: Uses your OpenAPI schema definitions
- Faker support: Includes x-faker placeholders in examples
- Real-time: Always reflects your current OpenAPI spec
- Standard format: Postman Collection v2.1
- Update the collection: If you change your OpenAPI spec, just re-download the collection
- Environment variables: Set up a Postman environment to easily switch between mock server and production
- Base URL: You can use Postman's environment variables to change the base URL:
{{baseUrl}}/users
The Postman collection URL is displayed when the server starts:
📦 Postman Collection: http://localhost:3000/_postman/collection.json