Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Help: getting data from notification request

ANSWERED

Hi, I'm new to fitbit api, I configured the endpoint in my server to receive notifications and now I'm getting them, I get notifications like these:

 

 

{ updates:
[ { fieldName: 'updates',
originalFilename: 'update1469047095888.json',
path: '/tmp/Skt92qATbUsLYIOMpNhrgy--.json',
headers:
{ 'content-disposition': 'form-data; name="updates"; filename="update1469047095888.json"',
'content-type': 'application/json',
'content-transfer-encoding': 'binary' },
size: 107 } ] }

so I know that a user just uploaded some data.

 

My question is how do I get that data? or that Json file that is generated?

 

 

any help will be appreciated!

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

the issue was that I set in https://dev.fitbit.com/apps/edit the endpoint as JSON files and not JSON Body

 

 

View best answer in original post

Best Answer
0 Votes
3 REPLIES 3

 

Not sure I understand correctly but that doesn't seem like a correct Fitbit Notification message.
 
You should see something like this:

[ { "collectionType":"foods", "date":"2010-03-01", "ownerId":"228S74", "ownerType":"user", "subscriptionId":"1234", }, { "collectionType":"foods", "date":"2010-03-02", "ownerId":"228S74", "ownerType":"user", "subscriptionId":"1234", }, { "collectionType":"activities", "date":"2010-03-01", "ownerId":"184X36", "ownerType":"user", "subscriptionId":"2345", } 


 
You can check the documentation here: https://dev.fitbit.com/docs/subscriptions/#example-notifications
 

Best Answer
0 Votes

@FedericoArg

mmm weird, I'm using node and when I parse the req.body is empty ({}).

 

the only way that I get data is using https://www.npmjs.com/package/multiparty#readme, to parse http requests with content-type multipart/form-data.

 

the data that I get is the one I posted below

 

 

Best Answer
0 Votes

the issue was that I set in https://dev.fitbit.com/apps/edit the endpoint as JSON files and not JSON Body

 

 

Best Answer
0 Votes