strava-api-client-resttemplate

Strava's API client with RestTemplate's library.

License

License

Categories

Categories

CLI User Interface
GroupId

GroupId

io.github.jfermat
ArtifactId

ArtifactId

strava-api-client-resttemplate
Last Version

Last Version

1.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

strava-api-client-resttemplate
Strava's API client with RestTemplate's library.
Project URL

Project URL

https://github.com/swagger-api/swagger-codegen
Source Code Management

Source Code Management

https://github.com/jfermat/strava-api-client-resttemplate

Download strava-api-client-resttemplate

How to add to project

<!-- https://jarcasting.com/artifacts/io.github.jfermat/strava-api-client-resttemplate/ -->
<dependency>
    <groupId>io.github.jfermat</groupId>
    <artifactId>strava-api-client-resttemplate</artifactId>
    <version>1.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/io.github.jfermat/strava-api-client-resttemplate/
implementation 'io.github.jfermat:strava-api-client-resttemplate:1.0.2'
// https://jarcasting.com/artifacts/io.github.jfermat/strava-api-client-resttemplate/
implementation ("io.github.jfermat:strava-api-client-resttemplate:1.0.2")
'io.github.jfermat:strava-api-client-resttemplate:jar:1.0.2'
<dependency org="io.github.jfermat" name="strava-api-client-resttemplate" rev="1.0.2">
  <artifact name="strava-api-client-resttemplate" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.github.jfermat', module='strava-api-client-resttemplate', version='1.0.2')
)
libraryDependencies += "io.github.jfermat" % "strava-api-client-resttemplate" % "1.0.2"
[io.github.jfermat/strava-api-client-resttemplate "1.0.2"]

Dependencies

compile (7)

Group / Artifact Type Version
io.swagger.core.v3 : swagger-annotations jar 2.0.0
org.springframework : spring-web jar 4.3.9.RELEASE
com.fasterxml.jackson.core : jackson-core jar 2.8.9
com.fasterxml.jackson.core : jackson-annotations jar 2.8.9
com.fasterxml.jackson.core : jackson-databind jar 2.8.9
com.fasterxml.jackson.jaxrs : jackson-jaxrs-json-provider jar 2.8.9
com.github.joschi.jackson : jackson-datatype-threetenbp jar 2.6.4

test (1)

Group / Artifact Type Version
junit : junit jar 4.13.1

Project Modules

There are no modules declared in this project.

Strava client RestTemplate

Strava API v3

  • API version: 3.0.0

The Swagger Playground is the easiest way to familiarize yourself with the Strava API by submitting HTTP requests and observing the responses before you write any client code. It will show what a response will look like with different endpoints depending on the authorization scope you receive from your athletes. To use the Playground, go to https://www.strava.com/settings/api and change your “Authorization Callback Domain” to developers.strava.com. Please note, we only support Swagger 2.0. There is a known issue where you can only select one scope at a time. For more information, please check the section “client code” at https://developers.strava.com/docs.

Automatically generated by the Swagger Codegen

Requirements

Building the API client library requires:

  1. Java 1.7+
  2. Maven/Gradle

Installation

To install the API client library to your local Maven repository, simply execute:

mvn clean install

Maven users

Add this dependency to your project's POM:

<dependency>
  <groupId>io.github.jfermat</groupId>
  <artifactId>strava-api-client-resttemplate</artifactId>
  <version>1.0.2</version>
  <scope>compile</scope>
</dependency>

Gradle users

Add this dependency to your project's build file:

compile "io.github.jfermat:strava-api-client-resttemplate:1.0.2"

Getting Started

Please follow the installation instruction and execute the following Java code:

import io.github.jfermat.strava.invoker.*;
import io.github.jfermat.strava.invoker.auth.*;
import io.github.jfermat.strava.model.*;
import io.github.jfermat.strava.api.ActivitiesApi;

import java.io.File;
import java.util.*;

public class ActivitiesApiExample {

    public static void main(String[] args) {
        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();
        }
    }
}
import io.github.jfermat.strava.invoker.*;
import io.github.jfermat.strava.invoker.auth.*;
import io.github.jfermat.strava.model.*;
import io.github.jfermat.strava.api.ActivitiesApi;

import java.io.File;
import java.util.*;

public class ActivitiesApiExample {

    public static void main(String[] args) {
        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();
        }
    }
}
import io.github.jfermat.strava.invoker.*;
import io.github.jfermat.strava.invoker.auth.*;
import io.github.jfermat.strava.model.*;
import io.github.jfermat.strava.api.ActivitiesApi;

import java.io.File;
import java.util.*;

public class ActivitiesApiExample {

    public static void main(String[] args) {
        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();
        }
    }
}
import io.github.jfermat.strava.invoker.*;
import io.github.jfermat.strava.invoker.auth.*;
import io.github.jfermat.strava.model.*;
import io.github.jfermat.strava.api.ActivitiesApi;

import java.io.File;
import java.util.*;

public class ActivitiesApiExample {

    public static void main(String[] args) {
        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();
        }
    }
}
import io.github.jfermat.strava.invoker.*;
import io.github.jfermat.strava.invoker.auth.*;
import io.github.jfermat.strava.model.*;
import io.github.jfermat.strava.api.ActivitiesApi;

import java.io.File;
import java.util.*;

public class ActivitiesApiExample {

    public static void main(String[] args) {
        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();
        }
    }
}
import io.github.jfermat.strava.invoker.*;
import io.github.jfermat.strava.invoker.auth.*;
import io.github.jfermat.strava.model.*;
import io.github.jfermat.strava.api.ActivitiesApi;

import java.io.File;
import java.util.*;

public class ActivitiesApiExample {

    public static void main(String[] args) {
        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();
        }
    }
}
import io.github.jfermat.strava.invoker.*;
import io.github.jfermat.strava.invoker.auth.*;
import io.github.jfermat.strava.model.*;
import io.github.jfermat.strava.api.ActivitiesApi;

import java.io.File;
import java.util.*;

public class ActivitiesApiExample {

    public static void main(String[] args) {
        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();
        }
    }
}
import io.github.jfermat.strava.invoker.*;
import io.github.jfermat.strava.invoker.auth.*;
import io.github.jfermat.strava.model.*;
import io.github.jfermat.strava.api.ActivitiesApi;

import java.io.File;
import java.util.*;

public class ActivitiesApiExample {

    public static void main(String[] args) {
        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();
        }
    }
}

Documentation for API Endpoints

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

Class Method HTTP request Description
ActivitiesApi createActivity POST /activities Create an Activity
ActivitiesApi getActivityById GET /activities/{id} Get Activity
ActivitiesApi getCommentsByActivityId GET /activities/{id}/comments List Activity Comments
ActivitiesApi getKudoersByActivityId GET /activities/{id}/kudos List Activity Kudoers
ActivitiesApi getLapsByActivityId GET /activities/{id}/laps List Activity Laps
ActivitiesApi getLoggedInAthleteActivities GET /athlete/activities List Athlete Activities
ActivitiesApi getZonesByActivityId GET /activities/{id}/zones Get Activity Zones
ActivitiesApi updateActivityById PUT /activities/{id} Update Activity
AthletesApi getLoggedInAthlete GET /athlete Get Authenticated Athlete
AthletesApi getLoggedInAthleteZones GET /athlete/zones Get Zones
AthletesApi getStats GET /athletes/{id}/stats Get Athlete Stats
AthletesApi updateLoggedInAthlete PUT /athlete Update Athlete
ClubsApi getClubActivitiesById GET /clubs/{id}/activities List Club Activities
ClubsApi getClubAdminsById GET /clubs/{id}/admins List Club Administrators
ClubsApi getClubById GET /clubs/{id} Get Club
ClubsApi getClubMembersById GET /clubs/{id}/members List Club Members
ClubsApi getLoggedInAthleteClubs GET /athlete/clubs List Athlete Clubs
GearsApi getGearById GET /gear/{id} Get Equipment
RoutesApi getRouteAsGPX GET /routes/{id}/export_gpx Export Route GPX
RoutesApi getRouteAsTCX GET /routes/{id}/export_tcx Export Route TCX
RoutesApi getRouteById GET /routes/{id} Get Route
RoutesApi getRoutesByAthleteId GET /athletes/{id}/routes List Athlete Routes
RunningRacesApi getRunningRaceById GET /running_races/{id} Get Running Race
RunningRacesApi getRunningRaces GET /running_races List Running Races
SegmentEffortsApi getEffortsBySegmentId GET /segment_efforts List Segment Efforts
SegmentEffortsApi getSegmentEffortById GET /segment_efforts/{id} Get Segment Effort
SegmentsApi exploreSegments GET /segments/explore Explore segments
SegmentsApi getLoggedInAthleteStarredSegments GET /segments/starred List Starred Segments
SegmentsApi getSegmentById GET /segments/{id} Get Segment
SegmentsApi starSegment PUT /segments/{id}/starred Star Segment
StreamsApi getActivityStreams GET /activities/{id}/streams Get Activity Streams
StreamsApi getRouteStreams GET /routes/{id}/streams Get Route Streams
StreamsApi getSegmentEffortStreams GET /segment_efforts/{id}/streams Get Segment Effort Streams
StreamsApi getSegmentStreams GET /segments/{id}/streams Get Segment Streams
UploadsApi createUpload POST /uploads Upload Activity
UploadsApi getUploadById GET /uploads/{uploadId} Get Upload

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

strava_oauth

Recommendation

It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.

io.github.jfermat

Swagger

Versions

Version
1.0.2
1.0.1
1.0.0