1) GRT CONTROLLER
Code Block |
---|
language | js |
---|
firstline | 1 |
---|
title | GetNearbyStops: Gets all nearby bus stops based on user location |
---|
|
$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 |
Code Block |
---|
language | js |
---|
title | GetStops: Returns a list of bus stops that matches the search keyword |
---|
|
$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
Code Block |
---|
language | js |
---|
title | GetFedBusSchedule: Gets Fed Bus schedule from the Fed Bus website. |
---|
|
$scope.portalHelpers.getApiData('transportation/GetFedBusSchedule').then(function(result){
console.log('feds bus schedule : ', result);
}); |
Code Block |
---|
title | GetGoTransitInfo: Gets Go Bus stops information from the Go Transit website |
---|
|
$scope.portalHelpers.getApiData('transportation/GetGoTransitStopInfo').then(function(result){
console.log('stop information : ', result);
}); |
3) STUDY SPACE CONTROLLER
Code Block |
---|
language | js |
---|
title | GetStudySpacesToday: Gets all study spaces that are available today. |
---|
|
$scope.portalHelpers.getApiData('StudySpace/GetStudySpacesToday').then(function(result){
console.log('study spaces : ', result);
}); |
4) FOOD CONTROLLER
Code Block |
---|
language | js |
---|
title | GetInfo:Returns a list of food locations and a list of menus for today. |
---|
|
$scope.portalHelpers.getApiData('food/GetInfo').then(function (result) {
console.log('food info: ', result);
}); |
Code Block |
---|
language | js |
---|
title | GetMenuInfoForDate:Gets today's menu through open data. |
---|
|
$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
Code Block |
---|
language | js |
---|
title | GetParkingLotInfo: Gets the parking lot information through open data. |
---|
|
$scope.portalHelpers.getApiData('Parking/GetParkingLotInfo').then(function (result){
console.log('parking lot info : ', result);
}); |
Code Block |
---|
language | js |
---|
title | GetNearbyParkingLots:Returns a list of parking lots ordered by distance to the user. |
---|
|
$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
Code Block |
---|
language | js |
---|
title | Sample Code: Info Sessions Controller |
---|
|
$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
Code Block |
---|
language | js |
---|
title | Speech Recognition API |
---|
|
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:
Code Block |
---|
language | js |
---|
title | Controller |
---|
|
.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/
Code Block |
---|
title | Sample Code: Recipe Puppy |
---|
|
$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. **
Code Block |
---|
language | js |
---|
title | Sample Code: IEX |
---|
|
$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:
Code Block |
---|
language | js |
---|
title | Sample Code: Open Trivia |
---|
|
$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
Code Block |
---|
language | js |
---|
title | Sample Code: chain.so |
---|
|
$http.get('/Develop/GetProxy?url=https://chain.so/api/v2/get_info/DOGE').success(function(data){
console.log("DOGE Crypto data: ", data);
}); |