Skip to content

Latest commit

 

History

History
471 lines (348 loc) · 16 KB

ActivitiesApi.md

File metadata and controls

471 lines (348 loc) · 16 KB

ActivitiesApi

All URIs are relative to https://www.strava.com/api/v3

Method HTTP request Description
createActivity POST /activities Create an Activity
getActivityById GET /activities/{id} Get Activity
getCommentsByActivityId GET /activities/{id}/comments List Activity Comments
getKudoersByActivityId GET /activities/{id}/kudos List Activity Kudoers
getLapsByActivityId GET /activities/{id}/laps List Activity Laps
getLoggedInAthleteActivities GET /athlete/activities List Athlete Activities
getZonesByActivityId GET /activities/{id}/zones Get Activity Zones
updateActivityById PUT /activities/{id} Update Activity

createActivity

DetailedActivity createActivity(name, type, startDateLocal, elapsedTime, description, distance, trainer, commute)

Create an Activity

Creates a manual activity for an athlete, requires activity:write scope.

Example

// Import classes:
//import io.github.jfermat.strava.invoker.ApiClient;
//import io.github.jfermat.strava.invoker.ApiException;
//import io.github.jfermat.strava.invoker.Configuration;
//import io.github.jfermat.strava.invoker.auth.*;
//import io.github.jfermat.strava.api.ActivitiesApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: strava_oauth
OAuth strava_oauth = (OAuth) defaultClient.getAuthentication("strava_oauth");
strava_oauth.setAccessToken("YOUR ACCESS TOKEN");

ActivitiesApi apiInstance = new ActivitiesApi();
String name = "name_example"; // String | 
String type = "type_example"; // String | 
OffsetDateTime startDateLocal = new OffsetDateTime(); // OffsetDateTime | 
Integer elapsedTime = 56; // Integer | 
String description = "description_example"; // String | 
Float distance = 3.4F; // Float | 
Integer trainer = 56; // Integer | 
Integer commute = 56; // Integer | 
try {
    DetailedActivity result = apiInstance.createActivity(name, type, startDateLocal, elapsedTime, description, distance, trainer, commute);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling ActivitiesApi#createActivity");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
name String
type String
startDateLocal OffsetDateTime
elapsedTime Integer
description String
distance Float
trainer Integer
commute Integer

Return type

DetailedActivity

Authorization

strava_oauth

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/json

getActivityById

DetailedActivity getActivityById(id, includeAllEfforts)

Get Activity

Returns the given activity that is owned by the authenticated athlete. Requires activity:read for Everyone and Followers activities. Requires activity:read_all for Only Me activities.

Example

// Import classes:
//import io.github.jfermat.strava.invoker.ApiClient;
//import io.github.jfermat.strava.invoker.ApiException;
//import io.github.jfermat.strava.invoker.Configuration;
//import io.github.jfermat.strava.invoker.auth.*;
//import io.github.jfermat.strava.api.ActivitiesApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: strava_oauth
OAuth strava_oauth = (OAuth) defaultClient.getAuthentication("strava_oauth");
strava_oauth.setAccessToken("YOUR ACCESS TOKEN");

ActivitiesApi apiInstance = new ActivitiesApi();
Long id = 789L; // Long | The identifier of the activity.
Boolean includeAllEfforts = true; // Boolean | To include all segments efforts.
try {
    DetailedActivity result = apiInstance.getActivityById(id, includeAllEfforts);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling ActivitiesApi#getActivityById");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
id Long The identifier of the activity.
includeAllEfforts Boolean To include all segments efforts. [optional]

Return type

DetailedActivity

Authorization

strava_oauth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getCommentsByActivityId

List<Comment> getCommentsByActivityId(id, page, perPage)

List Activity Comments

Returns the comments on the given activity. Requires activity:read for Everyone and Followers activities. Requires activity:read_all for Only Me activities.

Example

// Import classes:
//import io.github.jfermat.strava.invoker.ApiClient;
//import io.github.jfermat.strava.invoker.ApiException;
//import io.github.jfermat.strava.invoker.Configuration;
//import io.github.jfermat.strava.invoker.auth.*;
//import io.github.jfermat.strava.api.ActivitiesApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: strava_oauth
OAuth strava_oauth = (OAuth) defaultClient.getAuthentication("strava_oauth");
strava_oauth.setAccessToken("YOUR ACCESS TOKEN");

ActivitiesApi apiInstance = new ActivitiesApi();
Long id = 789L; // Long | The identifier of the activity.
Integer page = 56; // Integer | Page number. Defaults to 1.
Integer perPage = 30; // Integer | Number of items per page. Defaults to 30.
try {
    List<Comment> result = apiInstance.getCommentsByActivityId(id, page, perPage);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling ActivitiesApi#getCommentsByActivityId");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
id Long The identifier of the activity.
page Integer Page number. Defaults to 1. [optional]
perPage Integer Number of items per page. Defaults to 30. [optional] [default to 30]

Return type

List<Comment>

Authorization

strava_oauth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getKudoersByActivityId

List<SummaryAthlete> getKudoersByActivityId(id, page, perPage)

List Activity Kudoers

Returns the athletes who kudoed an activity identified by an identifier. Requires activity:read for Everyone and Followers activities. Requires activity:read_all for Only Me activities.

Example

// Import classes:
//import io.github.jfermat.strava.invoker.ApiClient;
//import io.github.jfermat.strava.invoker.ApiException;
//import io.github.jfermat.strava.invoker.Configuration;
//import io.github.jfermat.strava.invoker.auth.*;
//import io.github.jfermat.strava.api.ActivitiesApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: strava_oauth
OAuth strava_oauth = (OAuth) defaultClient.getAuthentication("strava_oauth");
strava_oauth.setAccessToken("YOUR ACCESS TOKEN");

ActivitiesApi apiInstance = new ActivitiesApi();
Long id = 789L; // Long | The identifier of the activity.
Integer page = 56; // Integer | Page number. Defaults to 1.
Integer perPage = 30; // Integer | Number of items per page. Defaults to 30.
try {
    List<SummaryAthlete> result = apiInstance.getKudoersByActivityId(id, page, perPage);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling ActivitiesApi#getKudoersByActivityId");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
id Long The identifier of the activity.
page Integer Page number. Defaults to 1. [optional]
perPage Integer Number of items per page. Defaults to 30. [optional] [default to 30]

Return type

List<SummaryAthlete>

Authorization

strava_oauth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getLapsByActivityId

List<Lap> getLapsByActivityId(id)

List Activity Laps

Returns the laps of an activity identified by an identifier. Requires activity:read for Everyone and Followers activities. Requires activity:read_all for Only Me activities.

Example

// Import classes:
//import io.github.jfermat.strava.invoker.ApiClient;
//import io.github.jfermat.strava.invoker.ApiException;
//import io.github.jfermat.strava.invoker.Configuration;
//import io.github.jfermat.strava.invoker.auth.*;
//import io.github.jfermat.strava.api.ActivitiesApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: strava_oauth
OAuth strava_oauth = (OAuth) defaultClient.getAuthentication("strava_oauth");
strava_oauth.setAccessToken("YOUR ACCESS TOKEN");

ActivitiesApi apiInstance = new ActivitiesApi();
Long id = 789L; // Long | The identifier of the activity.
try {
    List<Lap> result = apiInstance.getLapsByActivityId(id);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling ActivitiesApi#getLapsByActivityId");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
id Long The identifier of the activity.

Return type

List<Lap>

Authorization

strava_oauth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getLoggedInAthleteActivities

List<SummaryActivity> getLoggedInAthleteActivities(before, after, page, perPage)

List Athlete Activities

Returns the activities of an athlete for a specific identifier. Requires activity:read. Only Me activities will be filtered out unless requested by a token with activity:read_all.

Example

// Import classes:
//import io.github.jfermat.strava.invoker.ApiClient;
//import io.github.jfermat.strava.invoker.ApiException;
//import io.github.jfermat.strava.invoker.Configuration;
//import io.github.jfermat.strava.invoker.auth.*;
//import io.github.jfermat.strava.api.ActivitiesApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: strava_oauth
OAuth strava_oauth = (OAuth) defaultClient.getAuthentication("strava_oauth");
strava_oauth.setAccessToken("YOUR ACCESS TOKEN");

ActivitiesApi apiInstance = new ActivitiesApi();
Integer before = 56; // Integer | An epoch timestamp to use for filtering activities that have taken place before a certain time.
Integer after = 56; // Integer | An epoch timestamp to use for filtering activities that have taken place after a certain time.
Integer page = 56; // Integer | Page number. Defaults to 1.
Integer perPage = 30; // Integer | Number of items per page. Defaults to 30.
try {
    List<SummaryActivity> result = apiInstance.getLoggedInAthleteActivities(before, after, page, perPage);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling ActivitiesApi#getLoggedInAthleteActivities");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
before Integer An epoch timestamp to use for filtering activities that have taken place before a certain time. [optional]
after Integer An epoch timestamp to use for filtering activities that have taken place after a certain time. [optional]
page Integer Page number. Defaults to 1. [optional]
perPage Integer Number of items per page. Defaults to 30. [optional] [default to 30]

Return type

List<SummaryActivity>

Authorization

strava_oauth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getZonesByActivityId

List<ActivityZone> getZonesByActivityId(id)

Get Activity Zones

Summit Feature. Returns the zones of a given activity. Requires activity:read for Everyone and Followers activities. Requires activity:read_all for Only Me activities.

Example

// Import classes:
//import io.github.jfermat.strava.invoker.ApiClient;
//import io.github.jfermat.strava.invoker.ApiException;
//import io.github.jfermat.strava.invoker.Configuration;
//import io.github.jfermat.strava.invoker.auth.*;
//import io.github.jfermat.strava.api.ActivitiesApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: strava_oauth
OAuth strava_oauth = (OAuth) defaultClient.getAuthentication("strava_oauth");
strava_oauth.setAccessToken("YOUR ACCESS TOKEN");

ActivitiesApi apiInstance = new ActivitiesApi();
Long id = 789L; // Long | The identifier of the activity.
try {
    List<ActivityZone> result = apiInstance.getZonesByActivityId(id);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling ActivitiesApi#getZonesByActivityId");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
id Long The identifier of the activity.

Return type

List<ActivityZone>

Authorization

strava_oauth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

updateActivityById

DetailedActivity updateActivityById(id, body)

Update Activity

Updates the given activity that is owned by the authenticated athlete. Requires activity:write. Also requires activity:read_all in order to update Only Me activities

Example

// Import classes:
//import io.github.jfermat.strava.invoker.ApiClient;
//import io.github.jfermat.strava.invoker.ApiException;
//import io.github.jfermat.strava.invoker.Configuration;
//import io.github.jfermat.strava.invoker.auth.*;
//import io.github.jfermat.strava.api.ActivitiesApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: strava_oauth
OAuth strava_oauth = (OAuth) defaultClient.getAuthentication("strava_oauth");
strava_oauth.setAccessToken("YOUR ACCESS TOKEN");

ActivitiesApi apiInstance = new ActivitiesApi();
Long id = 789L; // Long | The identifier of the activity.
UpdatableActivity body = new UpdatableActivity(); // UpdatableActivity | 
try {
    DetailedActivity result = apiInstance.updateActivityById(id, body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling ActivitiesApi#updateActivityById");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
id Long The identifier of the activity.
body UpdatableActivity [optional]

Return type

DetailedActivity

Authorization

strava_oauth

HTTP request headers

  • Content-Type: /
  • Accept: application/json