Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Streams API no longer accepts resolution="all" #233

Open
djcunningham0 opened this issue Apr 14, 2022 · 3 comments
Open

Streams API no longer accepts resolution="all" #233

djcunningham0 opened this issue Apr 14, 2022 · 3 comments
Assignees

Comments

@djcunningham0
Copy link

"all" is not recognized as a valid value for the "resolution" parameter in the Streams API. When I make a request with resolution=all I get a 400 error. It still works for values of "high", "medium", and "low" (high seems to be the default now).

For what it's worth, the "resolution" parameter has been removed from the official docs, so maybe it will be completely removed in the future.

The loss of this parameter means it's impossible to get full resolution streams for long activities. Does anyone know if there's another way of getting that data?

https://github.com/hozn/stravalib/blob/b8d1181e32248c6570f0adfa995cb6c7adfccf62/stravalib/client.py#L1190-L1191

@lwasser
Copy link
Collaborator

lwasser commented Feb 12, 2024

hey there @djcunningham0 👋 i'm going through some of our older issues and cleaning things up.

here is where the new streams method is defined in our current API.

and in the strava docs it does show that a resolution is returned
Screenshot 2024-02-11 at 7 08 41 PM

which is also represented in our strava_model.py
module which is generated from the strava swagger.json file. As such it looks to me as if there is no resolution = all option available. our model allows for low, medium and high as you mention above.

does the "high" option not work for you? What gets returned when you try that? a filtered version of the activity?

Please let us know if this is still an issue.

if i don't hear from you in a week i will close this.

but if it's an ongoing issue i'm happy to test it out one some longer activities just to see what happens. I know i have been able to download the streams for long activities but i never looked closely at the point density / resolution.

@lwasser lwasser added the pending-response A label to track issues where we are waiting for a user response label Feb 12, 2024
@djcunningham0
Copy link
Author

It looks like this is no longer an issue. The solution is to not a value for the "resolution" parameter. If I don't specify resolution, it returns every single data point in the stream. (For comparison, if I specify resolution="high", then it trims condenses long activities down to ~8500 data points.) I don't know if the functionality changed since I opened the original issue or if I didn't notice the solution at the time, but that doesn't really matter going forward.

Some functionality and documentation could be improved (described below), but I'd consider it low priority. This issue could be closed since there's a way to get full resolution detail and it only affects very long activities anyway.


Inconsistencies:

(I'm testing with activity 7595268894, for reference.)

When I hit the API endpoint at /activities/{activity_id}/streams and specify the parameter resolution="high", the response object has the following attributes:

  • resolution = "high"
  • original_size = 49,320
  • data: <list with 8,892 elements> -- it did not pull all of the original data points!

When instead I hit the same endpoint (/activities/{activity_id}/streams) but I don't specify the resolution parameter, the response object has the following attributes:

  • resolution = "high" -- the same value as the other response, even though they actually have different resolution!
  • original_size = 49,320
  • data: <list with 49,320 elements> -- it contains all of the original data points

Suggestions:

  • When the user doesn't supply the resolution parameter in the API request, the response object should have resolution="None" or resolution="all", or some other value that differentiates it from resolution="high".
  • The documentation should be updated accordingly.

@lwasser
Copy link
Collaborator

lwasser commented Feb 20, 2024

hey @djcunningham0 👋 Thanks for coming back to this (old!) issue. This is unexpected behavior. Perhaps the way strava treats resolution is that you either want filtered data (filtered at whatever low, medium high thresholds they use) or not filtered (ie None / no filtering).

i also see in our code that this parameter is actually deprecated with a note about it being undocumented and thus actually unstable.

Would a statement in the docstring about how this works (noting that it is technically unsupported by Strava) above be helpful ? Our code is typed in a way that suggests the values low, medium, high and None are acceptable for this request.

resolution: Literal["low", "medium", "high"] | None = None,

But it isn't clear what resolution=None (or just no value provided for that param) returns as of now.

Would you be interested in submitting a small docstring clarification?

Maybe something like:

        resolution : str, optional
            Indicates desired number of data points. 'low' (100), 'medium'
            (1000) or 'high' (10000). A value of None will return full resolution data.
            .. deprecated::

                This param is not officially supported by the Strava API and
                may be removed in the future.

@lwasser lwasser added documentation and removed pending-response A label to track issues where we are waiting for a user response labels Feb 20, 2024
@lwasser lwasser self-assigned this Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants