StravaApiV3 - JavaScript client for strava_api_v3 Strava API This SDK is automatically generated by the Swagger Codegen project:
- API version: 3.0.0
- Package version: 3.0.0
- Build package: io.swagger.codegen.languages.JavascriptClientCodegen
For Node.js
To publish the library as a npm, please follow the procedure in "Publishing npm packages".
Then install it via:
npm install strava_api_v3 --save
To use the library locally without publishing to a remote npm registry, first install the dependencies by changing
into the directory containing package.json
(and this README). Let's call this JAVASCRIPT_CLIENT_DIR
. Then run:
npm install
Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR
:
npm link
Finally, switch to the directory you want to use your strava_api_v3 from, and run:
npm link /path/to/<JAVASCRIPT_CLIENT_DIR>
You should now be able to require('strava_api_v3')
in javascript files from the directory you ran the last
command above from.
If the library is hosted at a git repository, e.g. https://github.com/GIT_USER_ID/GIT_REPO_ID then install it via:
npm install GIT_USER_ID/GIT_REPO_ID --save
The library also works in the browser environment via npm and browserify. After following
the above steps with Node.js and installing browserify with npm install -g browserify
,
perform the following (assuming main.js is your entry file, that's to say your javascript file where you actually
use this library):
browserify main.js > bundle.js
Then include bundle.js in the HTML pages.
Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:
module: {
rules: [
{
parser: {
amd: false
}
}
]
}
Please follow the installation instruction and execute the following JS code:
var StravaApiV3 = require('strava_api_v3');
var defaultClient = StravaApiV3.ApiClient.instance;
// Configure OAuth2 access token for authorization: strava_oauth
var strava_oauth = defaultClient.authentications['strava_oauth'];
strava_oauth.accessToken = "YOUR ACCESS TOKEN"
var api = new StravaApiV3.ActivitiesApi()
var name = "name_example"; // {String} The name of the activity.
var type = "type_example"; // {String} Type of activity. For example - Run, Ride etc.
var startDateLocal = null; // {Object} ISO 8601 formatted date time.
var elapsedTime = 56; // {Number} In seconds.
var opts = {
'description': "description_example", // {String} Description of the activity.
'distance': 3.4, // {Number} In meters.
'trainer': 56, // {Number} Set to 1 to mark as a trainer activity.
'photoIds': null, // {Object} List of native photo ids to attach to the activity.
'commute': 56 // {Number} Set to 1 to mark as commute.
};
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.createActivity(name, type, startDateLocal, elapsedTime, opts, callback);
All URIs are relative to https://www.strava.com/api/v3
Class | Method | HTTP request | Description |
---|---|---|---|
StravaApiV3.ActivitiesApi | createActivity | POST /activities | Create an Activity |
StravaApiV3.ActivitiesApi | getActivityById | GET /activities/{id} | Get Activity |
StravaApiV3.ActivitiesApi | getCommentsByActivityId | GET /activities/{id}/comments | List Activity Comments |
StravaApiV3.ActivitiesApi | getKudoersByActivityId | GET /activities/{id}/kudos | List Activity Kudoers |
StravaApiV3.ActivitiesApi | getLapsByActivityId | GET /activities/{id}/laps | List Activity Laps |
StravaApiV3.ActivitiesApi | getLoggedInAthleteActivities | GET /athlete/activities | List Athlete Activities |
StravaApiV3.ActivitiesApi | getZonesByActivityId | GET /activities/{id}/zones | Get Activity Zones |
StravaApiV3.ActivitiesApi | updateActivityById | PUT /activities/{id} | Update Activity |
StravaApiV3.AthletesApi | getLoggedInAthlete | GET /athlete | Get Authenticated Athlete |
StravaApiV3.AthletesApi | getLoggedInAthleteZones | GET /athlete/zones | Get Zones |
StravaApiV3.AthletesApi | getStats | GET /athletes/{id}/stats | Get Athlete Stats |
StravaApiV3.AthletesApi | updateLoggedInAthlete | PUT /athlete | Update Athlete |
StravaApiV3.ClubsApi | getClubActivitiesById | GET /clubs/{id}/activities | List Club Activities |
StravaApiV3.ClubsApi | getClubAdminsById | GET /clubs/{id}/admins | List Club Administrators. |
StravaApiV3.ClubsApi | getClubById | GET /clubs/{id} | Get Club |
StravaApiV3.ClubsApi | getClubMembersById | GET /clubs/{id}/members | List Club Members |
StravaApiV3.ClubsApi | getLoggedInAthleteClubs | GET /athlete/clubs | List Athlete Clubs |
StravaApiV3.GearsApi | getGearById | GET /gear/{id} | Get Equipment |
StravaApiV3.RoutesApi | getRouteAsGPX | GET /routes/{id}/export_gpx | Export Route GPX |
StravaApiV3.RoutesApi | getRouteAsTCX | GET /routes/{id}/export_tcx | Export Route TCX |
StravaApiV3.RoutesApi | getRouteById | GET /routes/{id} | Get Route |
StravaApiV3.RoutesApi | getRoutesByAthleteId | GET /athletes/{id}/routes | List Athlete Routes |
StravaApiV3.RunningRacesApi | getRunningRaceById | GET /running_races/{id} | Get Running Race |
StravaApiV3.RunningRacesApi | getRunningRaces | GET /running_races | List Running Races |
StravaApiV3.SegmentEffortsApi | getEffortsBySegmentId | GET /segments/{id}/all_efforts | List Segment Efforts |
StravaApiV3.SegmentEffortsApi | getSegmentEffortById | GET /segment_efforts/{id} | Get Segment Effort |
StravaApiV3.SegmentsApi | exploreSegments | GET /segments/explore | Explore segments |
StravaApiV3.SegmentsApi | getLeaderboardBySegmentId | GET /segments/{id}/leaderboard | Get Segment Leaderboard |
StravaApiV3.SegmentsApi | getLoggedInAthleteStarredSegments | GET /segments/starred | List Starred Segments |
StravaApiV3.SegmentsApi | getSegmentById | GET /segments/{id} | Get Segment |
StravaApiV3.SegmentsApi | starSegment | PUT /segments/{id}/starred | Star Segment |
StravaApiV3.StreamsApi | getActivityStreams | GET /activities/{id}/streams | Get Activity Streams |
StravaApiV3.StreamsApi | getRouteStreams | GET /routes/{id}/streams | Get Route Streams |
StravaApiV3.StreamsApi | getSegmentEffortStreams | GET /segment_efforts/{id}/streams | Get Segment Effort Streams |
StravaApiV3.StreamsApi | getSegmentStreams | GET /segments/{id}/streams | Get Segment Streams |
StravaApiV3.UploadsApi | createUpload | POST /uploads | Upload Activity |
StravaApiV3.UploadsApi | getUploadById | GET /uploads/{uploadId} | Get Upload |
- StravaApiV3.ActivityStats
- StravaApiV3.ActivityTotal
- StravaApiV3.ActivityType
- StravaApiV3.ActivityZone
- StravaApiV3.BaseStream
- StravaApiV3.Comment
- StravaApiV3.Error
- StravaApiV3.ExplorerResponse
- StravaApiV3.ExplorerSegment
- StravaApiV3.Fault
- StravaApiV3.HeartRateZoneRanges
- StravaApiV3.Lap
- StravaApiV3.LatLng
- StravaApiV3.MetaActivity
- StravaApiV3.MetaAthlete
- StravaApiV3.MetaClub
- StravaApiV3.PhotosSummary
- StravaApiV3.PhotosSummaryPrimary
- StravaApiV3.PolylineMap
- StravaApiV3.PowerZoneRanges
- StravaApiV3.Route
- StravaApiV3.RouteDirection
- StravaApiV3.RunningRace
- StravaApiV3.SegmentLeaderboard
- StravaApiV3.SegmentLeaderboardEntry
- StravaApiV3.Split
- StravaApiV3.StreamSet
- StravaApiV3.SummaryGear
- StravaApiV3.SummarySegment
- StravaApiV3.SummarySegmentEffort
- StravaApiV3.TimedZoneDistribution
- StravaApiV3.UpdatableActivity
- StravaApiV3.Upload
- StravaApiV3.ZoneRange
- StravaApiV3.ZoneRanges
- StravaApiV3.Zones
- StravaApiV3.AltitudeStream
- StravaApiV3.CadenceStream
- StravaApiV3.DetailedGear
- StravaApiV3.DetailedSegment
- StravaApiV3.DetailedSegmentEffort
- StravaApiV3.DistanceStream
- StravaApiV3.HeartrateStream
- StravaApiV3.LatLngStream
- StravaApiV3.MovingStream
- StravaApiV3.PowerStream
- StravaApiV3.SmoothGradeStream
- StravaApiV3.SmoothVelocityStream
- StravaApiV3.SummaryActivity
- StravaApiV3.SummaryAthlete
- StravaApiV3.SummaryClub
- StravaApiV3.TemperatureStream
- StravaApiV3.TimeStream
- StravaApiV3.TimedZoneRange
- StravaApiV3.DetailedActivity
- StravaApiV3.DetailedAthlete
- StravaApiV3.DetailedClub
- Type: OAuth
- Flow: accessCode
- Authorization URL: https://www.strava.com/api/v3/oauth/authorize
- Scopes:
- read: Read public segments, public routes, public profile data, public posts, public events, club feeds, and leaderboards
- read_all: Read private routes, private segments, and private events for the user
- profile:read_all: Read all profile information even if the user has set their profile visibility to Followers or Only You
- profile:write: Update the user's weight and Functional Threshold Power (FTP), and access to star or unstar segments on their behalf
- activity:read: Read the user's activity data for activities that are visible to Everyone and Followers, excluding privacy zone data
- activity:read_all: The same access as activity:read, plus privacy zone data and access to read the user's activities with visibility set to Only You
- activity:write: Access to create manual activities and uploads, and access to edit any activities that are visible to the app, based on activity read access level