public class UploadServiceImpl extends StravaServiceImpl<UploadAPI> implements UploadService
Implementation of UploadService
requestRate, requestRateDaily, restService| Modifier and Type | Method and Description |
|---|---|
StravaUploadResponse |
checkUploadStatus(Integer id)
Upon upload, Strava will respond with an upload ID.
|
static UploadService |
instance(Token token)
Returns an instance of
segment effort services |
StravaUploadResponse |
upload(StravaActivityType activityType,
String name,
String description,
Boolean _private,
Boolean trainer,
String dataType,
String externalId,
File file)
Requires write permissions, as requested during the authorization process.
|
accessTokenIsValid, getToken, requestRateDailyPercentage, requestRatePercentagepublic static UploadService instance(Token token)
Returns an instance of segment effort services
Instances are cached so that if 2 requests are made for the same token, the same instance is returned
token - The Strava access token to be used in requests to the Strava APIpublic StravaUploadResponse upload(StravaActivityType activityType, String name, String description, Boolean _private, Boolean trainer, String dataType, String externalId, File file)
UploadServiceRequires 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.
URL POST https://www.strava.com/api/v3/uploads
upload in interface UploadServiceactivityType - (Optional) Type of activity being uploadedname - (Optional) if not provided, will be populated using start date and location, if availabledescription - (Optional)_private - (Optional) set to 1 to mark the resulting activity as private, 'view_private' permissions will be necessary to view the activitytrainer - (Optional) activities without lat/lng info in the file are auto marked as stationary, set to 1 to forcedataType - possible values: fit, fit.gz, tcx, tcx.gz, gpx, gpx.gzexternalId - (Optional) data filename will be used by default but should be a unique identifierfile - the actual activity data, if gzipped the data_type must end with .gzUploadService.upload(javastrava.api.v3.model.reference.StravaActivityType, java.lang.String, java.lang.String,
java.lang.Boolean, java.lang.Boolean, java.lang.String, java.lang.String, java.io.File)public StravaUploadResponse checkUploadStatus(Integer id)
UploadServiceUpon 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.
URL GET https://www.strava.com/api/v3/uploads/:id
checkUploadStatus in interface UploadServiceid - Upload id originally returned when the upload was doneUploadService.checkUploadStatus(java.lang.Integer)Copyright © 2015 Dan Shannon. All rights reserved.