04-25-2018 19:16
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

04-25-2018 19:16
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
When using the simulator I have no issue using fetch and grabbing some data from an API, then passing it to the from the companion app to the fitbit with the messenging service. When i deploy it to the actual fitbit I'm getting a null. Am i missing a cert or something?
Answered! Go to the Best Answer.

Accepted Solutions
05-04-2018 00:09
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


05-04-2018 00:09
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I'm pretty sure fetch is only supporting https. The simulator doesn't have that restriction though.

04-27-2018 14:13
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

04-27-2018 14:13
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Did you double check that you set the permissions properly in the package.json? Can you post a code snippet?

05-03-2018 17:53
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

05-03-2018 17:53
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
export function usgsCall(site){ const host = `http://waterservices.usgs.gov/nwis/iv/?format=json&sites=${site}&period=P1D`; return fetch(host, { method : "GET"}) .then(function(response){ return response.json(); }) .then(function(data) { let obj = data.value.timeSeries; console.log(data.value.timeSeries); for (var key in obj){ if (obj.hasOwnProperty(key)) { if(obj[key].variable.unit.unitCode === "ft3/s"){ var cfs = obj[key].values[0].value[0].value; var four = cfs - obj[key].values[0].value[12].value; var two = cfs - obj[key].values[0].value[8].value; var half = cfs - obj[key].values[0].value[2].value; } if(obj[key].variable.unit.unitCode === "ft"){ var feet = obj[key].values[0].value[0].value; } } } return {cfs: cfs, feet: feet, four: four, two: two, half: half}; }) .catch(function(error) { console.log(error, 'error'); }); }
The error will be throw but wont actual print anything.

05-03-2018 17:55
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

05-03-2018 17:55
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Its the fetch itself where i'm running into an issue i believe.

05-03-2018 19:09
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

05-03-2018 19:09
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
This is the error I'm pulling.
SyntaxError: Unexpected end of JSON input

05-04-2018 00:09
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


05-04-2018 00:09
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I'm pretty sure fetch is only supporting https. The simulator doesn't have that restriction though.

05-10-2018 23:07 - edited 05-10-2018 23:10
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

05-10-2018 23:07 - edited 05-10-2018 23:10
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I can call an HTTP web server from a local network when running on the versa but I can't do an HTTP request to a public IP address, I'm also getting a null.
Making HTTP requests should be allowed.
Nonetheless, Where can we find more info about what's allowed and what not?

