Testing an API Mock Application
After creating a Mock application, you can test the Rest API against a live endpoint.
Either the defined simple response or advanced response is returned when sending a request.
Note: When a simple response is defined, mock response data takes high priority:
- If the application 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; then 404 is returned.
- If multiple response codes are defined, you can add a customer request header
X-TIBCO-Mock-Response-Codeto 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 to copy the endpoint. Test the API Mock application 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
/petto the endpoint URL.
Click the Endpoint link and click View API. The browser opens Swagger UI of the Mock application. On Swagger UI, you can test the API.
For example, when sending a request to get a pet with a
3, an error is returned as shown in the Response Result screenshot.