dustedrob / jstrava Goto Github PK
View Code? Open in Web Editor NEWJava Libraries for the Strava API
License: MIT License
Java Libraries for the Strava API
License: MIT License
Retrieve the recent activities performed by members of a specific club. The authenticated athlete must be a member of the club. Pagination is supported.
Parameters
id: integer required
page: integer optional
per_page: integer optional
Returns an array of activity summary representations.
Only distance, altitude and latlng stream types are available.
Parameters
id: integer required
types: list of strings
single stream type or comma-separated list of types, if the activity does not have that stream it will not be included in the response
resolution: string optional
low (100), medium (1000) or high (10000), default is all,
indicates desired number of data points, streams will only be down sampled
series_type: string relevant only if using resolution
either ‘time’ or ‘distance’, default is ‘distance’,
used to index the streams if the stream is being reduced
Returns an array of unordered stream objects.
Upon upload, Strava will respond with an upload ID. You may use this ID to poll the status of your upload. Strava recommends polling no more than once a second. Polling more frequently is unnecessary. The mean processing time is around 8 seconds.
List athlete K/QOMs/CRs
Returns an array of segment efforts representing KOMs/QOMs and course records held by the given athlete. Results are sorted by date, newest first. Pagination is supported.
Parameters
id: integer required
page: integer optional
per_page: integer optional
Returns an array of segment effort summary representations.
List starred segment
Returns a summary representation of the segments starred by the authenticated user.
A segment effort represents an attempt on a segment. This resource returns a subset of the activity streams that correspond to that effort.
All streams for a given segment effort will be the same length and the values at a given index correspond to the same time.
This resource is available for all public efforts.
Parameters
id: integer required
types: list of strings
single stream type or comma-separated list of types, if the activity does not have that stream it will not be included in the response
resolution: string optional
low (100), medium (1000) or high (10000), default is all,
indicates desired number of data points, streams will only be down sampled
series_type: string relevant only if using resolution
either ‘time’ or ‘distance’, default is ‘distance’,
used to index the streams if the stream is being reduced
Returns an array of unordered stream objects.
Heartrate and power zones are set by the athlete. This endpoint returns the time (seconds) in each zone. The distribution is not customizable. Requires an access token associated with the owner of the activity and the owner must be a premium user.
It is generally poor practice to do I/O in the constructor:
JStrava/src/org/jstrava/connector/JStravaV3.java
Lines 828 to 835 in 3ed3a5f
Maybe do the lookup in getCurrentAthlete()
instead and cache the response?
Creating manually entered activities:
List Athlete activities method from the API
List activity laps
This resource will return all laps for an activity. Laps are triggered by athletes using their respective devices, such as Garmin watches.
Parameters
id: integer required
Returns an array of lap effort summaries similar to the objects on the right.
Retrieve details about a specific segment effort. The effort must be public or it must correspond to the current athlete.
Parameters
id: integer required
Returns a detailed segment effort representation.
Retrieve a club
Retrieve details about a specific club. The club must be public or the current athlete must be a member.
Parameters
id: integer required
Returns a detailed club representation. This is currently the same as the summary representation returned by other calls.
Leaderboards represent the ranking of athletes on specific segments. Filter by age_group and weight_class is only allowed if the authenticated athlete is a Strava premium member.
Parameters
id: integer required
gender: string optional
‘M’ or ‘F’
age_group: string optional
‘0_24’, ‘25_34’, ‘35_44’, ‘45_54’, ‘55_64’, ‘65_plus’
weight_class: string optional
pounds ‘0_124’, ‘125_149’, ‘150_164’, ‘165_179’, ‘180_199’, ‘200_plus’ or kilograms ‘0_54’, ‘55_64’, ‘65_74’, ‘75_84’, ‘85_94’, ‘95_plus’
following: boolean optional
club_id: integer optional
date_range: string optional
‘this_year’, ‘this_month’, ‘this_week’, ‘today’
per_page: integer optional
Returns an array of up to 10, by default, leaderboard entry objects similar to the example response to the right.
Requires write permissions, as requested during the authorization process.
Posting a file for upload will enqueue it for processing. Initial checks will be done for malformed data and duplicates.
Add methods for all the Authentication operations from the API:
Update activity method from the API
Retrieve summary information about members of a specific club. Pagination is supported.
Parameters
id: integer required
page: integer optional
per_page: integer optional
Returns an array of athlete summary representations.
Create Streams entity
Streams is the Strava term for the raw data associated with an activity. All streams for a given activity or segment effort will be the same length and the values at a given index correspond to the same time.
Object attributes
type: string
data: array
array of stream values
series_type: string
series type used for down sampling, will be present even if not used
original_size: integer
complete stream length
resolution: string
‘low’, ‘medium’ or ‘high’
This endpoint can be used to find popular segments starting within an area.
Parameters
bounds: floats required
comma separated list of bounding box corners
‘sw.lat,sw.lng,ne.lat,ne.lng’
‘south,west,north,east’
activity_type: string optional
‘running’ or ‘riding’, default is riding
min_cat: integer optional
Minimum climb category filter
max_cat: integer optional
Maximum climb category filter
Returns an array of up to 10 segment objects similar to the example response to the right.
List photos
The number of photos is included in the activity summary and detail responses. Use this endpoint to retrieve a list of photos associated with this activity. This endpoint can only be accessed by the owner of the activity.
Parameters
id: integer required
Returns an array of photos objects.
@dustedrob I am looking into to your code for a project. Do you have any thoughts on usage of your code, e.g., type of license?
Currently working without parameters support:
List activity comments
The number of comments is included in the activity summary and detail responses. Use this endpoint to retrieve a list of comments left on a given activity. Pagination is supported.
Parameters
id: integer required
markdown: boolean optional
include markdown in comments, default is false/filter out
page: integer optional
per_page: integer optional
The field that indicates a private activity is always false.
To fix this use this annotation
@SerializedName("private")
Retrieve details about a specific segment.
Parameters
id: integer required
Returns a detailed representation of the segment.
Delete an activity
Requires write permissions, as requested during the authorization process.
Parameters
id: integer required
Returns 204 No Content on success.
when i use junit for test,it return 401. Unauthorized
Once the token exchage is completed. It will return a json object with the token and a detailed representation of the authenticated athlete.
http://strava.github.io/api/v3/oauth/#post-token
Methods for the Friends and Followers operations from the API:
List efforts
Retrieve an array of segment efforts, for a given segment, filtered by athlete and/or a date range. Pagination is supported.
Streams represent the raw data of the uploaded file. External applications may only access this information for activities owned by the authenticated athlete.
While there are a large number of stream types, they may not exist for all activities. If a stream type does not exist for the activity, it will be ignored.
All streams for a given activity will be the same length and the values at a given index correspond to the same time. For example, the time from the time stream can be correlated to the lat/lng or watts streams.
Parameters
id: integer required
types: list of strings
single stream type or comma-separated list of types, if the activity does not have that stream it will not be included in the response
resolution: string optional
low (100), medium (1000) or high (10000), default is all,
indicates desired number of data points, streams will only be down sampled
series_type: string relevant only if using resolution
either ‘time’ or ‘distance’, default is ‘distance’,
used to index the streams if the stream is being reduced
I'm new to maven, and I'm not sure how I should include the Jstrava project in one of my project. Do I install it locally using "mvn install", do I copy the jstrava.jar generated or do I somehow add this github repo to my build (using maven or something else?). Will there be releases in the future?
Thanks
Retrieve details about a specific item of gear.
Parameters
id: string required
Returns a detailed gear representation.
Currently working without parameters support:
List activity kudoers
The number of kudos is included in the activity summary and detailed representations. This endpoint is for retrieving more detailed information on the athletes who’ve left kudos and can only be accessed by the owner of the activity. Pagination is supported.
Parameters
id: integer required
page: integer optional
per_page: integer optional
Retrieve the recent activities performed by those the current athlete is following.
I have projects, connect to Strava to get activities of a user. So, I already connected to Strava and get access_token, then I want to use method List activities = strava.getCurrentAthleteActivities(); to get activities of a user but it is not working. Please give me some advice, thank you
Fetch an array of clubs that the currently authenticated athlete is a member of.
Returns a club summary representation. This is currently the same as the detailed representation returned by other calls.
Method for updating an Athlete
http://strava.github.io/api/v3/athlete/
Hi and thanks for providing us with this library – I wanted to give it a shot. Unfortunately I cannot retrieve my activities, which I tried with the following code:
JStravaV3 strava = new JStravaV3(ACCESS_TOKEN);
List<Activity> activities = strava.getCurrentAthleteActivitiesAll().stream()
.filter(x -> x.getType().equals("StravaActivityType.run"))
.collect(Collectors.toList());
I get this exception:
Exception in thread "main" com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: Expected an int but was 40.1 at line 1 column 180 path $[0].total_elevation_gain
at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:245)
at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:235)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:129)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:220)
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:41)
at com.google.gson.internal.bind.ArrayTypeAdapter.read(ArrayTypeAdapter.java:72)
at com.google.gson.Gson.fromJson(Gson.java:887)
at com.google.gson.Gson.fromJson(Gson.java:852)
at com.google.gson.Gson.fromJson(Gson.java:801)
at com.google.gson.Gson.fromJson(Gson.java:773)
at org.jstrava.api.JStravaV3.getCurrentAthleteActivities(JStravaV3.java:309)
at org.jstrava.api.JStravaV3.getCurrentAthleteActivitiesAll(JStravaV3.java:287)
at org.vandeseer.stravanalyzor.MainJStrava.getDataFromStrava(MainJStrava.java:31)
at org.vandeseer.stravanalyzor.MainJStrava.main(MainJStrava.java:19)
Caused by: java.lang.NumberFormatException: Expected an int but was 40.1 at line 1 column 180 path $[0].total_elevation_gain
at com.google.gson.stream.JsonReader.nextInt(JsonReader.java:1196)
at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:243)
... 13 more
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.