Logo
15_Days_of_Postman_-_for_testers_IvanKo API Documentation

Mocks-Server Responses

Number of APIs: 5


1. Get a server response

GET {{baseUrl}}/mocks/{{mockId}}/server-responses/{{serverResponseId}}

Gets information about a server response.



2. Get all server responses

GET {{baseUrl}}/mocks/{{mockId}}/server-responses

Gets all of a mock server's server responses.



3. Create a server response

POST {{baseUrl}}/mocks/{{mockId}}/server-responses

Creates a server response. Server responses let you simulate 5xx server-level responses, such as 500 or 503.

Server-level responses are agnostic to application-level logic. Server responses let you simulate this behavior on a mock server. You do not need to define each error for all exposed paths on the mock server.

If you set a server response as active, then all the calls to the mock server return with that active server response.

Note:

You can create multiple server responses for a mock server, but only one mock server can be set as active.

You must include the following properties in the request body:

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

  • statusCode — An integer value that contains the server stub's 5xx response code. This property only accepts 5xx values.

You can also include the following optional properties:

  • headers — An array of objects that contains the server stub's headers:

    • key — A string value that contains the header's key.
    • value — A string value that contains the header key's value. This value defines the corresponding value for the header key.
  • body — A string value that contains a response body that returns when you call the mock server.



4. Update a server response

PUT {{baseUrl}}/mocks/{{mockId}}/server-responses/{{serverResponseId}}

Updates a mock server's server response. Include at least one of the following properties in the request body:

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

  • statusCode — A string value that contains the server stub's response code. This property only accepts 5xx values.

  • headers — An array of objects that contains the server stub's headers:

    • key — A string value that contains the header's key.
    • value — A string value that contains the header key's value. This value defines the corresponding value for the header key.
  • body — A string value that contains a response body that returns when you call the mock server.



5. Delete a server response

DELETE {{baseUrl}}/mocks/{{mockId}}/server-responses/{{serverResponseId}}

Deletes a mock server's server response.



ENDPOINTS