Testing an API Mock App
After creating a Mock app, you can test the REST API against a live endpoint.
Either the defined simple response or advanced response is returned when sending a request.
If you switch to the Simple Mock Response section when Implementing Mock Response Data, the defined simple response is returned; if you switch to the Switch to Advanced Responses section, the defined JavaScript code is returned.
Note: When a simple response is defined, mock response data takes high priority:
- If the app has defined mock response data; then the defined mock response data is returned.
- If no mock response data is defined; then response example is returned.
- If no response example is defined; "no content" with the respective status code is returned.
- If multiple response codes are defined, you can add a customer request header
X-TIBCO-Mock-Response-Code
to define which response code is returned; otherwise, the first defined response code is returned.
Choose one of the following ways to test the REST API:
-
Click the Endpoint link and click Copy URL to copy the endpoint. Test the API Mock App using Postman or other REST client tools against the endpoint.
Note: You have to add the resource path to the URL to view the resource operations. For example, for
petstoreapplication
, you have to add/pet
to the endpoint URL. Also note that Copy URL is only available for public endpoints. -
From the Mock App Details page, click the Endpoint link and click View and Test. The browser opens the Swagger UI for the Mock App. On the Swagger UI, you can test the API. Click < to the left of the top name and description to return to the Mock App Details page.