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.
In Studio, click the basepoint URL,
http://localhost:8081/console/, that appears in APIkit Consoles.
Your default browser opens
The API Console appears showing an API summary and information about the project, such as the version and protocol.
Click the hamburger menu, or expand the width of your browser, if necessary to display simulation controls for API resources.
In API Summary, click GET for the
The HTTP 200 response indicating success and the JSON example you expect for the
In API Summary, click the
usersresource to see documentation about methods and sub-resources.
In API Summary, expand
/userbyid. Click GET for the
/usersbyidresource, and click Try It.
Parameters and Headers tabs appear where you can add query parameters and headers to requests.
Check Show Optional Parameters, and click Send.
The HTTP 200 response indicating success appears. The JSON example for the
/usersbyidresource, which is the user information for the user having id 3, appears.
Now, you are ready to implement the endpoint.