API Data Buffet Reference Sheet
1) GRT CONTROLLER
$scope.portalHelpers.getApiData('grt/GetNearbyStops?userLat=' + ENTER_USER_LATITUDE + '&userLong=' + ENTER_USER_LONGITUDE).then(function(result){ console.log('bus stops: ', result); }); USER_LATITUDE: type Double USER_LONGITUDE: type Double
$scope.portalHelpers.getApiData('grt/GetStops?search=' + ENTER_A_STRING).then(function(result){ console.log('matching bus stops: ', result); }); STOP_ID: type String
2) TRANSPORTATION CONTROLLER
$scope.portalHelpers.getApiData('transportation/GetFedBusSchedule').then(function(result){ console.log('feds bus schedule : ', result); });
$scope.portalHelpers.getApiData('transportation/GetGoTransitStopInfo').then(function(result){ console.log('stop information : ', result); });
3) STUDY SPACE CONTROLLER
$scope.portalHelpers.getApiData('StudySpace/GetStudySpacesToday').then(function(result){ console.log('study spaces : ', result); });
4) FOOD CONTROLLER
$scope.portalHelpers.getApiData('food/GetInfo').then(function (result) { console.log('food info: ', result); });
$scope.portalHelpers.getApiData('food/GetMenuInfoForDate?date=" + ENTER_DATE).then(function (result){ console.log('menu for date : ', result); }); DATE: type DateTime (C#) **To create the date in JavaScript, use the below code as a guideline for formatting** First, create variables named month, date, year (all should have numeric values). Then, use the below formatting to create the date: var monthFormat = (month.length === 1) ? ("0" + month) : month; var dayFormat = (day.length === 1) ? ("0" + day) : day; var newDate = year + "-" + monthFormat + "-" + dayFormat;
5) PARKING CONTROLLER
$scope.portalHelpers.getApiData('Parking/GetParkingLotInfo').then(function (result){ console.log('parking lot info : ', result); });
$scope.portalHelpers.getApiData('Parking/GetNearbyParkingLots?userLat=' + ENTER_USER_LATITUDE + '&userLong=' + ENTER_USER_LONGITUDE).then(function (result){ console.log('nearby parking lots : ', result); }); USER_LATITUDE: type Double USER_LONGITUDE: type Double
6) INFO SESSION CONTROLLER
To get your API key for this API, register here. You should receive the key instantly.
How to use the API itself is given here: https://github.com/uWaterloo/api-documentation/blob/master/v2/terms/term_infosessions.md
$http.get('/Develop/GetProxy?url=https://api.uwaterloo.ca/v2/terms/1141/infosessions.json?key=YOUR_API_KEY').success(function(data){ console.log("infosessions: ", data); });
7) SPEECH RECOGNITION
eg: var grammar = '#JSGF V1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new SpeechRecognition(); var speechRecognitionList = new SpeechGrammarList(); speechRecognitionList.addFromString(grammar, 1); recognition.grammars = speechRecognitionList;
More information can be found here: https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition
FOR THE APIs BELOW, LOOK THROUGH THE API REFERENCE DOCUMENTATION IN THE SDK TO LEARN HOW TO ACCESS THEM. EXAMPLES ARE ALSO PROVIDED BELOW:
Before looking at the rest of the APIs, make sure your controller looks like this:
.controller('YOUR_WIDGETCtrl', ['$scope', '$http', function ($scope, $http) {
8) RECIPE PUPPY
Go through a database of over a million recipes by keyword or search query. More information can be found here: http://www.recipepuppy.com/about/api/
$http.get('/Develop/GetProxy?url=http://www.recipepuppy.com/api/?i=onions,garlic&q=omelet&p=3 ').success(function(data){ console.log("Recipes: ", data); });
9) IEX
Get stock prices and other financial information. Instructions on how to use the API can be found here: https://iextrading.com/developer/docs/#unofficial-libraries-and-integrations
**Please Note: IEX has policies regarding displaying information recieved from their API. This is also included in the above documentation. **
$http.get('/Develop/GetProxy?url=https://api.iextrading.com/1.0/stock/aapl/chart').success(function(data){ console.log("Apple Stock Info: ", data); });
10) OPEN TRIVIA
Generate as many trivia questions as your heart desires. API usage information can be found here: https://opentdb.com/api_config.php
**The above way of making GET requests does not work with this API. Use the code down below instead:
$http({ method: 'GET', url: 'https://opentdb.com/api_category.php' }).then(function successCallback(response) { console.log("trivia questions: ", response); }, function errorCallback(response) { console.log("error: ", response); // called asynchronously if an error occurs // or server returns response with an error status. });
11) SO CHAIN BLOCKCHAIN API
The easiest, most cost-effective solution to building applications on Bitcoin, LiteCoin etc. Information on how to use the API can be found here: https://chain.so/api
$http.get('/Develop/GetProxy?url=https://chain.so/api/v2/get_info/DOGE').success(function(data){ console.log("DOGE Crypto data: ", data); });