Create Mock Server
POST https://api.getpostman.com/mocks?workspace={{workspaceId}}
Create Mock Server
Creates a Mock Server on a Collection.
Overview
Body Tab
mock
— An object that contains:name
— A string that contains the Workspace's name.collection
— A string value that contains the Collection UID for the Mock Server.
Sends the secondCollectionUid
variable that houses the ID of the Collection that we built for the Mock Server.
Pre-request Script Tab
Sends a message to the Console that the Request is starting to create a Mock Server.
Tests Tab
- Checks for a 200 HTTP response to confirm that the new Mock Server has been created.
- Parse the Response.
- Sets the new URL and ID as the value for
mockUrl
andmockUid
Collection Variables.
Request Params
Key | Datatype | Required | Description |
---|---|---|---|
workspace | string |
Request Body
{"mock"=>{"name"=>"Scaffolded Mock Server | {{today}}", "collection"=>"{{secondCollectionUid}}"}}
HEADERS
Key | Datatype | Required | Description |
---|---|---|---|
Content-Type | string |
RESPONSES
status: OK
{"mock":{"id":"0fca2246-c108-41f5-8454-cc032def329f","owner":"1679925","uid":"1679925-0fca2246-c108-41f5-8454-cc032def329f","collection":"1679925-39fee52f-b806-3ffa-1173-00a6f5b183dc","environment":"1679925-0b9e9f15-3208-a2b1-22e0-d58392f01524","mockUrl":"https://0fca2246-c108-41f5-8454-cc032def329f.mock.pstmn.io"}}