04-25-2018 19:16
04-25-2018 19:16
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.
Best Answer05-04-2018 00:09
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
05-04-2018 00:09
I'm pretty sure fetch is only supporting https. The simulator doesn't have that restriction though.
Best Answer04-27-2018 14:13
04-27-2018 14:13
Did you double check that you set the permissions properly in the package.json? Can you post a code snippet?
Best Answer05-03-2018 17:53
05-03-2018 17:53
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.
Best Answer05-03-2018 17:55
05-03-2018 17:55
Its the fetch itself where i'm running into an issue i believe.
Best Answer05-03-2018 19:09
05-03-2018 19:09
This is the error I'm pulling.
SyntaxError: Unexpected end of JSON input
Best Answer05-04-2018 00:09
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
05-04-2018 00:09
I'm pretty sure fetch is only supporting https. The simulator doesn't have that restriction though.
Best Answer05-10-2018 23:07 - edited 05-10-2018 23:10
05-10-2018 23:07 - edited 05-10-2018 23:10
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?
Best Answer