Skip to content
This repository was archived by the owner on Jul 1, 2024. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions samples/tidePooler/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

/**
* This sample shows how to create a Lambda function for handling Alexa Skill requests that:
* - Web service: communicate with an external web service to get tide data from NOAA CO-OPS API (http://tidesandcurrents.noaa.gov/api/)
* - Web service: communicate with an external web service to get tide data from NOAA CO-OPS API (https://tidesandcurrents.noaa.gov/api/)
* - Multiple optional slots: has 2 slots (city and date), where the user can provide 0, 1, or 2 values, and assumes defaults for the unprovided values
* - DATE slot: demonstrates date handling and formatted date responses appropriate for speech
* - Custom slot type: demonstrates using custom slot types to handle a finite set of known values
Expand Down Expand Up @@ -39,7 +39,7 @@
*/
var APP_ID = undefined;//replace with 'amzn1.echo-sdk-ams.app.[your-unique-value-here]';

var http = require('http'),
var https = require('https'),
alexaDateUtil = require('./alexaDateUtil');

/**
Expand Down Expand Up @@ -335,18 +335,18 @@ function getFinalTideResponse(cityStation, date, response) {
}

/**
* Uses NOAA.gov API, documented: http://tidesandcurrents.noaa.gov/api/
* Results can be verified at: http://tidesandcurrents.noaa.gov/noaatidepredictions/NOAATidesFacade.jsp?Stationid=[id]
* Uses NOAA.gov API, documented: https://tidesandcurrents.noaa.gov/api/
* Results can be verified at: https://tidesandcurrents.noaa.gov/noaatidepredictions/NOAATidesFacade.jsp?Stationid=[id]
*/
function makeTideRequest(station, date, tideResponseCallback) {

var datum = "MLLW";
var endpoint = 'http://tidesandcurrents.noaa.gov/api/datagetter';
var endpoint = 'https://tidesandcurrents.noaa.gov/api/datagetter';
var queryString = '?' + date.requestDateParam;
queryString += '&station=' + station;
queryString += '&product=predictions&datum=' + datum + '&units=english&time_zone=lst_ldt&format=json';

http.get(endpoint + queryString, function (res) {
https.get(endpoint + queryString, function (res) {
var noaaResponseString = '';
console.log('Status Code: ' + res.statusCode);

Expand Down