03-06-2019 14:22
03-06-2019 14:22
Please I wanted to send data from fibit studio app to php file as a post request.
Best Answer03-12-2019 16:17
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.
03-12-2019 16:17
Within in the companion, you can use fetch() to send a POST request to an https endpoint.
https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch
Best Answer03-13-2019 21:50 - edited 03-14-2019 19:40
03-13-2019 21:50 - edited 03-14-2019 19:40
var url = 'http://qav2.cs.odu.edu/fitbit/test.php';
var data = {username: 'example'};
function postData(){
fetch(url, {
method: 'POST', // or 'PUT'
body: data, // data can be `string` or {object}!
headers:{
'Content-Type': 'application/text'
}
}).then(res => res)
.then(response => console.log('Success:', response))
.catch(error => console.error('Error:', error));
}
setTimeout(postData, 2000);If I Keep this in companion will it work? or it is not working in my end, Can some tell me how to resolve this issue?
Best Answer04-09-2019 12:58
04-09-2019 12:58
Hi, I am also facing a similar issue in my companion code, POST request just isn't firing and not getting any errors either, so a blackbox to debug.
I believe this may be an iOS device related issue. I tested my code in companion and on an Android device and it works seamlessly.
@JonFitbit can you provide some information or guidance regarding this please?
Best Answer