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
Step 1: Create a new HTTP GET API endpoint
Step 2: Define the default response of the new GET API
Step 3: Add additional responses to the new API for enabling response simulation
<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
Now add a response that returns HTTP Status Code 500
{"message": "Product Info API", "statusCode": 500, "description": "The API Server has encountered an internal error"}
Step 4: Save the API and enable response simulation
Step 5: Test the API