Invoke an API using the Integrated API Console¶
WSO2 API Manager has an integrated API Console, which allows you to visualize the API contract and interact with API's resources without being aware of the backend logic.
Let's see how to use the API Console in the Developer Portal to invoke an API.
You can only try out HTTPS-based APIs via the API Console because the Developer Portal runs on HTTPS.
The examples here use the
PizzaShack REST API, which was created in Create a REST API.
Sign in to the WSO2 Developer Portal (
https://<hostname>:9443/devportal) and click an API (e.g.,
Subscribe to the API (e.g.,
PizzaShackAPI1.0.0) using an application and an available throttling policy.
Click Applications and then click on the application that you used to subscribe to the API. Click Production Keys and navigate to OAuth2 Tokens.
Scroll down and generate a production key
Production and Sandbox Tokens
To generate keys for the Sandbox endpoint, go to the Sandbox Keys tab. For more information, see Maintaining Separate Production and Sandbox Gateways.
As the application is self-contained (JWT), copy the generated access token before proceeding to the next step.
Click APIs, and click on the API that you need to invoke.
Click Try Out in API Overview tab.
The OpenAPI UI (API Console) to test the PizzaShack API appears.
Enter the copied access token in the Authorization field.
Expand the GET method and click Try it out. Click Execute.
If you cannot invoke the API's HTTPS endpoint (this causes the SSLPeerUnverified exception), it could be because the security certificate issued by the server is not trusted by your browser. To resolve this issue, access the HTTPS endpoint directly from your browser and accept the security certificate.
If WSO2 API Manager has a certificate signed by a Certificate Authority (CA), the HTTPS endpoints should work out-of-the-box.
Note the successful response for the API invocation.
You have now successfully invoked an API using the Open API Console
Get a test key to invoke an API¶
When you want to test out the process of invoking an API resource, you can easily get a test key from the API console rather than going back to the Applications page and generating a key. Click Try Out to navigate to the API Console, click on the
GET TEST KEY button to generate a test key.
TEST KEY will be generated with default scopes attached to the API. If you need to generate a token with specific scopes, go to the application view and generate a token.