Logo
15_Days_of_Postman_-_for_testers_IvanKo API Documentation

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.

 

Body PARAM

Key Datatype Required Description 



HEADERS

Key Datatype Required Description 




RESPONSES

status OK

{ "createdAt": "2022-08-02T15:08:03.000Z", "updatedAt": "2022-08-02T15:58:12.000Z", "id": "965cdd16-fe22-4d96-a161-3d05490ac421", "name": "Service Unavailable", "statusCode": 503, "headers": [ { "key": "Content-type", "value": "application/json" } ], "language": "json", "body": "{\n \"message\": \"Service is temporarily unavailable due to maintenance. Please reach out to support if the problem persists.\"\n}", "createdBy": "12345678", "updatedBy": "12345678", "mock": "e3d951bf-873f-49ac-a658-b2dcb91d3289" }



Curl
curl -X PUT 'https://api.getpostman.com/mocks/mockId/server-responses/serverResponseId' -d '{"serverResponse":{"name":"serverStubName","statusCode":"statusCode","headers":[{"key":"headerKey","value":"headerValue"}],"body":"serverStubBody"}}'

ENDPOINTS