APIs can be tested in several ways and using different tools:
- API Explorer - Feature within the Yale Developer Portal to try the Portal APIs.
- Insomnia - Powerful browser extension or mac app to test APIs.
- SOAPUI - Open-source web service testing application.
- Web Browser - Test APIs directly in a browser if authentication for the API is none or API key based.
- cURL - Test APIs from your local computer using command line tools.
The Yale Developer Portal includes the API Explorer tool for developers to try out the Portal APIs.
NOTE: Be sure you have created an Application within the developer portal that has access to the API you wish to try. Review the Manage Applications and API Keys section within the Access to APIs how-to for additional information.
Within API Explorer:
- Select an API from the drop down menu.
- Select an App/API Key from the drop down menu.
- Click Edit and then select the Authentication Type “API Key” from the drop down menu.
- Click Save.
- Click “Expand Operations” on the right and add/edit parameters as desired.
- Click Submit.
- The API Explorer displays the query that it sent to the API and the response from the API.
NOTE: Scroll to the bottom of the response to translate the query to another programming language by selecting the language from the drop down menu within “Code Samples.”
Easy to use, yet very powerful API testing tool. More information and documentation can be found on the Insomnia website.
SoapUI is an open-source web service testing application for service-oriented architectures and representational state transfers. More information and documentation can be found on the SOAPUI website.
In the browser address bar, compose a query URL for the API to access. The format of query URL is:
https:// hostname / api ? apikey=value
hostname - hostname listed for the API service
https://gw.its.yale.edu/soa-gateway/buildings/feed?type=json&apikey=0a1b3c4d5e6f7g8h9i0j1k2l3m412345 *apikey in example is not a valid API key
//get Building Room Data in XML curl --include --request GET 'https://gw.its.yale.edu/soa-gateway/buildings/feed?method=getRoomData&apikey=0a1b3c4d5e6f7g8h9i0j1k2l3m412345' //get Laundry Room Data in JSON curl --include --request GET 'https://gw.its.yale.edu/soa-gateway/laundry/school?type=json&method=getRoomData&apikey=0a1b3c4d5e6f7g8h9i0j1k2l3m412345'
*apikey in example is not a valid API key