Logo
15_Days_of_Postman_-_for_testers_IvanKo API Documentation

Mocks

Number of APIs: 7


1. Get a mock server

GET {{baseUrl}}/mocks/{{mockId}}

Gets information about a mock server.



2. 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.



3. Get all mock servers

GET {{baseUrl}}/mocks

Gets all mock servers. By default, this endpoint returns only mock servers you created across all workspaces.

Note:

If you pass both the teamId and workspace query parameters, this endpoint only accepts the workspace query.



4. Delete a mock server

DELETE {{baseUrl}}/mocks/{{mockId}}

Deletes a mock server.



5. Unpublish a mock server

DELETE {{baseUrl}}/mocks/{{mockId}}/unpublish

Unpublishes a mock server. Unpublishing a mock server sets its Access Control configuration setting to private.



6. Publish a mock server

POST {{baseUrl}}/mocks/{{mockId}}/publish

Publishes a mock server. Publishing a mock server sets its Access Control configuration setting to public.



7. Update a mock server

PUT {{baseUrl}}/mocks/{{mockId}}

Updates a mock server. Include the mock object in the request body with one or more of the following properties:

  • name — A string value that contains the mock server's name.

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

  • 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.

  • versionTag — A string value that contains the API's version tag ID.

  • config — An object that contains the following properties:

    • serverResponseId — A string value that contains the server response ID. This sets the given server response as the default response for each request.



ENDPOINTS