Create a mock server
POST https://api.getpostman.com/mocks?workspace={{workspaceId}}
Creates a mock server in a collection. Include a mock
object in the request body that contains following properties:
-
collection
— A string that contians the collection ID.
You can include the following optional properties in the request body:
-
environment
— A string that contains the environment ID to associate with the mock server. -
name
— A string that contains the the mock server's name.
Request Params
Key | Datatype | Required | Description |
---|---|---|---|
workspace | string | Optional. A workspace ID in which to create the mock server. |
If you do not include this query parameter, the system creates the mock server in your "My Workspace" workspace. |
Request Body
{"mock"=>{"collection"=>"{{collectionId}}", "environment"=>"{{environmentId}}", "name"=>"{{mockName}}"}}
HEADERS
Key | Datatype | Required | Description |
---|---|---|---|
Content-Type | string |
RESPONSES
status: OK
{"mock":{"id":"e3d951bf-873f-49ac-a658-b2dcb91d3289","owner":"1679925","uid":"1679925-e3d951bf-873f-49ac-a658-b2dcb91d3289","collection":"1679925-39fee52f-b806-3ffa-1173-00a6f5b183dc","mockUrl":"https://e3d951bf-873f-49ac-a658-b2dcb91d3289.mock.pstmn.io","name":"Test Mock","config":{"headers":[],"matchBody":false,"matchQueryParams":true,"matchWildcards":true,"delay":null,"serverResponseId":null},"createdAt":"2022-06-09T19:00:39.000Z","updatedAt":"2022-06-09T19:00:39.000Z","environment":"1679925-0b9e9f15-3208-a2b1-22e0-d58392f01524"}}