Contact Us 1-800-664-9073

On Saturday April 1, 2023, from 9 AM to 2 PM (PDT), docs.mulesoft.com content will be unavailable due to scheduled maintenance.

To Simulate API Calls

Simulating calls to the API is a critical design task that helps you troubleshoot problems and demo the API to prospective users even before you have implemented it. The simulation depends on certain parts the RAML:

  • An examples of data the actual implementation would return

  • An HTTP status codes and responses the API returns

When you simulate a valid request to the API and all goes well, API Console returns the status code 200 and example data.

In this procedure, you locate the URL for API Console. You enter the URL in a browser to simulate calls to the API. This procedure assumes you just finished running the APIkit project to generate a Mule flow. In the simulation, you make a call to consume a JSON resource and filter user information.

  1. In Studio, click the basepoint URL, http://localhost:8081/console/, that appears in APIkit Consoles.

    APIkit console tab displays the location of the basepoint URL in the window.

    Your default browser opens.

    The API Console appears showing an API summary and information about the project, such as the version and protocol.

    API console version info.
  2. Click the hamburger menu, or expand the width of your browser, if necessary to display simulation controls for API resources.

    API console summary.
  3. In API Summary, click GET for the /users resource.

    The HTTP 200 response indicating success and the JSON example you expect for the /users resource appears.

    APIkit response
  4. In API Summary, click the users resource to see documentation about methods and sub-resources.

  5. In API Summary, expand /userbyid. Click GET for the /usersbyid resource, and click Try It.

    Parameters and Headers tabs appear where you can add query parameters and headers to requests.

  6. Check Show Optional Parameters, and click Send.

    The HTTP 200 response indicating success appears. The JSON example for the /usersbyid resource, which is the user information for the user having id 3, appears.

    Information for the user having id 3 appears.

Now, you are ready to implement the endpoint.

View on GitHub