Create a mock server

POST {{baseUrl}}/mocks

Creates a mock server in a collection. Include a mock object in the request body that contains following properties:

  • collection — A string value that contains the collection UID.

You can include the following optional properties in the request body:

  • environment — A string value that contains the environment UID to associate with the mock server.
  • name — A string value that contains the the mock server's name.
  • private — A boolean value that, if true, sets the mock server as private. By default, mock servers are public and can receive requests from anyone and anywhere.

Note:

You cannot create mocks for collections added to an API definition.

Request Params

KeyDatatypeRequiredDescription
workspacestringA 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. |

HEADERS

KeyDatatypeRequiredDescription
Content-Typestring

RESPONSES

status: OK

{"mock":{"id":"e3d951bf-873f-49ac-a658-b2dcb91d3289","owner":"12345678","uid":"12345678-e3d951bf-873f-49ac-a658-b2dcb91d3289","collection":"12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2","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":"12345678-5daabc50-8451-43f6-922d-96b403b4f28e"}}