Simulating API Calls Using the Mocking Service
To simulate calls to your API, use the mocking service in the API Console of the portal, you can simulate calls to your API. The mocking service is a feature of Anypoint that enables you to generate simulated servers to help you develop and test APIs. These mock servers imitate the actions of accepting requests and providing responses. The mocking service replicates the functionality of a genuine API.
Before You Begin
You must have an API specification with at least one endpoint and one method in it.
Simulate a Call to an API Using an Internal URL
To access the internal URL, you must specify the authorization headers as part of the request URL. To test an API without supplying authorization headers, generate a mocking service public URL for this project. The mocking service is the selected server in the Try it pane.
-
On the Home or the APIs page, select a REST API.
-
Select the API specification tab.
-
Click a method like
GET
. -
In the Documentation pane, review the requests and responses data.
-
In the Try it pane, enter query parameters you want to test.
You can enter query parameters as name-value pairs.
-
Click Send.
API Console displays the HTTP return code as specified in your API. Alternately, you can test the API by copying the Request URL and paste it into a web browser or Postman.