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

Subscriptions: update notifications

Hi All,

 

this is the specification of update notification requests:

https://wiki.fitbit.com/display/API/Fitbit+Subscriptions+API#FitbitSubscriptionsAPI-NotificationForm...

 

I implemented a Java handler based on this specification but it did not recognize the incoming notification (I got HTTP Status 400 in th response).

 

After some debugging I discovered that notifications do not actually adhere to the specification. This is an example of request to my endpoint: 

 

Accept: */*

Accept-Encoding: gzip, deflate

Connection: close

Content-Length: 114

Content-Type: application/json

Host: rerex.inf.unibz.it

Runscope-Request-Port: 8080

Runscope-Request-Source: dashboard

User-Agent: python-requests/2.5.3 CPython/2.7.5 Linux/3.10.0-123.13.2.el7.x86_64

X-Fitbit-Signature: HS+UYg3QdytFtQ/H3QhrS6t2Jmg=

 
[{"collectionType":"activities","date":"2015-05-13","ownerId":"2FRQC5","ownerType":"user","subscriptionId":"107"}]

 

So I needed to change my java handler as follows (I include the only the method signature):

@RequestMapping(value = "/fitbitnotification", method = RequestMethod.POST)

@ResponseBody
public ResponseEntity<String> fitbitNotification(
@RequestHeader("X-Fitbit-Signature") String fitbitSignature,
@RequestBody String updates)

 

And then I was sble to successfully rocess incoming notifications.

 

I have two questions:

1) Have you changed the notification format whitout updating the documentation? Could you please do the update?

2) The new specification is stable so I can b seure that my handlre will work in the future?

 

Thanks a lot!

 

Floriano

 

 

Best Answer
0 Votes
0 REPLIES 0