Search Results

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 Adding and Editing Mock Response Data, the defined simple response is returned; if you switch to the Switch to Advanced Responses section when Adding and Editing Mock Response Data, 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; then 404 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 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.

  • Click the Endpoint link and click View API. The browser opens Swagger UI of the Mock App. On Swagger UI, you can test the API.

    For example, when sending a request to get a pet with a petId of 3, an error is returned as shown in the Response Result screenshot.

    Response Result