Fitbit.NET icon indicating copy to clipboard operation
Fitbit.NET copied to clipboard

Subscription urls are inconsistent

Open WestDiscGolf opened this issue 8 years ago • 7 comments

I have found an issue with subscriptions and the urls the add function is using. I was looking at the differences between the AddSubscription method which has been there a while and the Remove method Mau added. I couldn't work out why the format strings were different between them. On investigation there seems have been changes missed and/or merged out since the original migration to v2 :-(

If you look at the history of FormatKey you can see what was there - https://github.com/aarondcoleman/Fitbit.NET/commit/8081da18 - The URLs have changed from when the original migration was done for version one.

This needs addressing before final 2.0 release

WestDiscGolf avatar Mar 12 '16 11:03 WestDiscGolf

Hi Adam, Looks like things were rearranged, but on first glance the outputs of the URLs aren't the same? Did you discover an example one we can compare URLs?

aarondcoleman avatar Mar 13 '16 15:03 aarondcoleman

Other than trying to setup some subscriptions the only thing I have to go on is the documentation - https://dev.fitbit.com/docs/subscriptions/

The urls have changed! :-(

WestDiscGolf avatar Mar 13 '16 20:03 WestDiscGolf

Hi Adam, I'm still confused. Are you suggesting that a) Fitbit's endpoints have changed and the library uses the old versions or b) in the course of migration we messed up the existing endpoint collections? Somewhere you're seeing a difference from what we have to what's expected, so I'm trying to understand what that example is? Are we formatting that url string wrong by your view?

aarondcoleman avatar Mar 13 '16 20:03 aarondcoleman

Hi, When I did the original migration from the old to the new for Add I moved the same urls as was over to the new way of working, but with the json extension, and used the FormatKey to determine the URL instead of the original switch statement as per the commit I linked to in the original post.

I believe the URLs which were used and migrated have now changed and the current Add method is using the wrong ones ... according to the documentation

WestDiscGolf avatar Mar 13 '16 20:03 WestDiscGolf

Example? What's there vs what the docs say?

On Sunday, March 13, 2016, Adam Storr [email protected] wrote:

Hi, When I did the original migration from the old to the new for Add I moved the same urls as was over to the new way of working, but with the json extension, and used the FormatKey to determine the URL instead of the original switch statement as per the commit I linked to in the original post.

I believe the URLs which were used and migrated have now changed and the current Add method is using the wrong ones ... according to the documentation

— Reply to this email directly or view it on GitHub https://github.com/aarondcoleman/Fitbit.NET/issues/165#issuecomment-196047550 .

aarondcoleman avatar Mar 13 '16 20:03 aarondcoleman

Old/Original Migrated to Async - https://github.com/aarondcoleman/Fitbit.NET/blob/async-portable/Fitbit.Portable/FitbitClient.cs#L705

Example of new - https://dev.fitbit.com/docs/subscriptions/#adding-a-subscription

WestDiscGolf avatar Mar 13 '16 20:03 WestDiscGolf

I see the difference now.

Example:

Old subscription url: "https://api.fitbit.com/1/user/-/activities/apiSubscriptions/X1Y2Z3-activities.json" -- source

New subscription url: "https://api.fitbit.com/1/user/-/activities/apiSubscriptions/X1Y2Z3.json" -- source

mxa0079 avatar Mar 14 '16 17:03 mxa0079