07-20-2016 13:50
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-20-2016 13:50
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
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!
Answered! Go to the Best Answer.

- Labels:
-
OAuth 2.0
-
Subscriptions API
Accepted Solutions
07-20-2016 14:31
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-20-2016 14:31
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
the issue was that I set in https://dev.fitbit.com/apps/edit the endpoint as JSON files and not JSON Body

07-20-2016 13:58
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-20-2016 13:58
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
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

07-20-2016 14:04
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-20-2016 14:04
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
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

07-20-2016 14:31
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-20-2016 14:31
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
the issue was that I set in https://dev.fitbit.com/apps/edit the endpoint as JSON files and not JSON Body

