Logo
30daysofpostman API Documentation

Update a server stub

PUT https://api.getpostman.com/mocks/{{mockUid}}/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.

 

Body PARAM

Key Datatype Required Description 



HEADERS

Key Datatype Required Description 




RESPONSES

status OK

{ "createdAt": "2022-05-02T09:38:04.000Z", "updatedAt": "2022-05-02T09:38:04.000Z", "id": "7a2cd600-cf51-4e8a-b802-5e458828f4e5", "name": "Service Unavailable", "statusCode": 503, "headers": [ { "key": "Content-Type", "value": "application/json" } ], "language": "json", "body": "{\n \"message\": \"Service is temporarily unavailable due to maintenance. If the problem persists, reach out to support.\"\n}", "createdBy": "1", "updatedBy": "1", "mock": "0fca2246-c108-41f5-8454-cc032def329f" }



Curl
curl -X PUT 'https://api.getpostman.com/mocks/mockUid/server-responses/serverResponseId' -d '{"serverResponse":{"name":"Service Unavailable","statusCode":503,"headers":[{"key":"Content-type","value":"application/json"}],"body":"{\n \"message\": \"Service is temporarily unavailable due to maintenance. Please reach out to support if the problem persists.\"\n}"}}'

ENDPOINTS