Update a server response

PUT https://api.getpostman.com/mocks/{{mockId}}/server-responses/{{serverResponseId}}

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

  • name — A string that contains the server response's name.
  • statusCode — A string 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 that contains the header's key.
    • value — A string that contains the header key's value. This value defines the corresponding value for the header key.
  • body — A string that contains a response body that returns when you call the mock server.

Request Body

{"serverResponse"=>{"name"=>"{{serverStubName}}", "statusCode"=>"{{statusCode}}", "headers"=>[{"key"=>"{{headerKey}}", "value"=>"{{headerValue}}"}], "body"=>"{{serverStubBody}}"}}

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"}