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.
RESPONSES
status: OK
{"createdAt":"2022-08-02T15:08:03.000Z","updatedAt":"2022-08-02T15:08:03.000Z","id":"965cdd16-fe22-4d96-a161-3d05490ac421","name":"Internal Server Error","statusCode":500,"headers":[],"language":null,"body":"{\n \"message\": \"Something went wrong; try again later.\"\n}","createdBy":"20891195","updatedBy":"20891195","mock":"32cd624d-9986-4f20-9048-89252f722269"}