In the
previous tutorial
we created a mock REST API capable of returning multiple responses with the same HTTP Status Code.
In this tutorial we will be creating a mock REST API that will return responses with different HTTP Status Codes.
You can also watch the step-by-step instructions in the video below
<p><b>Product Info</b> - This is a mock REST API demo by Api On Cloud (https://www.apioncloud.com)</p>
We will add a few more responses in the same way
{"message": "Product Info API", "statusCode": 202 }
Now let's define a response that returns HTTP Status Code 404
Oops! The API endpoint you called does not exist
Nod add a response that returns HTTP Status Code 500
{"message": "Product Info API", "statusCode": 500, "description": "The API Server has encountered an internal error"}
We now have a mock API endpoint capable of returning different responses when simulation mode is enabled.