11-24-2020 11:39 - edited 11-24-2020 14:55
11-24-2020 11:39 - edited 11-24-2020 14:55
I am a little confused about the verification of subscriber endpoints.
In the documentation, "Verifying a Subscriber" section, it states the verification sends a GET request:
For example, the following should result in a 204:
GET https://yourapp.com/fitbit/webhook?verify=correctVerificationCode
And the following should result in a 404:
GET https://yourapp.com/fitbit/webhook?verify=incorrectVerificationCode
However, in the "Receiving Update Notifications" section, it describes the notification as a POST:
Notification Format
An update notification request to your endpoint is defined as follows:
HTTP Method | POST |
Content-Type | application/json or multipart/form-data |
Parameter/part name | updates |
Parameter/part Content-Type | text/xml or text/javascript |
Questions:
Thanks for the clarifications.
Answered! Go to the Best Answer.
12-07-2020 17:18
12-07-2020 17:18
Hi @Jeff_New_Ocean,
Thanks for your feedback. This was really well written and will help drive some improvements to the Subscriptions API. The challenges for verifying a subscriber URL have already been acknowledged by our team.
In the meantime, here are the answers to your questions:
- Is it true that the verification requests are GET requests, but the actual notifications are POST requests? This implies that your verification isn't verifying the same endpoint that is used for the subscription notifications.
- Given this, do I need to handle verification requests on the POST as well?
- Are verification requests sent again periodically after the initial verification?
- How can I re-verify my endpoint from the applications page?
- Right now I have my GET endpoint set up to return a 204-NO CONTENT, which is correct for a GET response with no content body. However, my POST endpoint for the same path is returning a 201-CREATED, as one would expect from a successful POST response. In the documentation it says this will cause the subscriber endpoint to be disabled, but that doesn't seem to be the case. Is that because the verification is only done on my GET endpoint, which is still returning a 204?
I hope this helps. Let me know if you have any additional questions.
12-07-2020 17:18
12-07-2020 17:18
Hi @Jeff_New_Ocean,
Thanks for your feedback. This was really well written and will help drive some improvements to the Subscriptions API. The challenges for verifying a subscriber URL have already been acknowledged by our team.
In the meantime, here are the answers to your questions:
- Is it true that the verification requests are GET requests, but the actual notifications are POST requests? This implies that your verification isn't verifying the same endpoint that is used for the subscription notifications.
- Given this, do I need to handle verification requests on the POST as well?
- Are verification requests sent again periodically after the initial verification?
- How can I re-verify my endpoint from the applications page?
- Right now I have my GET endpoint set up to return a 204-NO CONTENT, which is correct for a GET response with no content body. However, my POST endpoint for the same path is returning a 201-CREATED, as one would expect from a successful POST response. In the documentation it says this will cause the subscriber endpoint to be disabled, but that doesn't seem to be the case. Is that because the verification is only done on my GET endpoint, which is still returning a 204?
I hope this helps. Let me know if you have any additional questions.
12-18-2020 10:32 - edited 12-18-2020 12:09
12-18-2020 10:32 - edited 12-18-2020 12:09
Thanks JohnFitbit for the clarifications!
Sorry for the delay, I was out for a couple weeks.
Also, I wanted to let you know that while my POST subscription endpoint was returning a 201 (instead of the prescribed 204), it didn't seem to cause an issue, other than it wasn't logged as green. I switched it back to return 204 on success so that it meets the requirement though.