Step 4: Testing and Consuming the API
The PublicEchoAPI_Stringer can now be consumed. You are going to test if your API is invokable. Testing is done in the API Developer Portal, but you have easy access from within API Management.
Testing API Access and Policy Functionality
Open tab Overview of the API details page. In section API Endpoint click Try!:
The test UI opens in a new browser tab. Refer to the Swagger homepage for more information about the functions of the Swagger UI.
At the top of the page, the Base URL and the link to the API definition are displayed. Expand the displayed operations to start testing:
As configured in tutorial step 3, consumers of the API should not be able to execute POST requests on resource /HelloWorld. Therefore, you should see only one GET method here:
Open the GET /HelloWorld method. Click Execute to test the GET request:
In section Curl you can see the actual call. In the Response body section, you can see the actual response of the service. The call returned the string Hello World! along with the current timestamp:
Now you know that the PublicEchoAPI is invokable. The API can be consumed as intended.
Follow Our Example User Story
You now can inform David that the API is published and ready to use.
Consuming the API
Follow Our Example User Story
Now that the PublicEchoAPI has been published, David Stringer wants to test if it is visible to all visitors of the API Developer Portal and can be used by everyone.
Open the API Developer Portal of your PAS installation and make sure that you are not logged in with your PAS user.
Recommendation: Open the portal in an ingocnito window of your current browser or open it in a different browser.
In the Marketplace, search for your PublicEchoAPI_Stringer. Click Learn more:
The API details view opens. Click API Documentation to open the test UI:
Open the GET request and click Execute:
In section Curl you can see the actual call. In the Response body section, you can see the actual response of the service. The call returned the string Hello World! along with the current timestamp:
From the details view, you can directly copy the Public Endpoint to consume the API:
Important Note on Public APIs
Once you have published a public API it is available online and can be consumed by everyone.
If you have tried this tutorial on your own system, we therefore recommend that you disable or delete the created API afterwards if the customer system is accessible to the public. If you want to follow our recommendation, see Step 5: Disabling the API.
Related Documentation: