Test a REST API¶
Testing APIs refers to the process of trying out the APIs in the Publisher itself to make sure that the APIs meet the required functionalities and behavior.
WSO2 API Manager's Publisher offers an integrated API Console that allows API creators and API publishers to visualize the API contract and interact with API's resources.
Follow the instructions below to use the Publisher test console to test an API:
Note
Create the PizzaShack
REST API or an API of your choice before following the instructions below. For more information, see Create a REST API..
-
Sign in to the Publisher.
https://<hostname>:9443/publisher
For testing purposes, you can use
https://localhost:9443/publisher
andadmin
as the username and password.The list of APIs that are available in the Publisher appears.
-
Click on the API that you wish to test.
Let's use the sample
PizzaShack
REST API. -
Go to Test and click Try Out.
Note
- The API can be tested in any lifecycle state, and can be used in any state except for the "retired" state. Even in the "block" state you can still try it out, but you will get a 503 (service unavailable) response.
-
You can generate the internal key by clicking on the Generate Key button to invoke and test the PizzaShack API.
Note
- The UI generates an Internal token to authenticate the API call.
- If the API Publishers have a token or key, then they can paste it in the UI and invoke the API using that key.
-
Expand the GET method, click Try it out, and click Execute.
Note the successful response for the API invocation.