String url = DEFAULT_ENDPOINT+"/user?oauth_token=";
final String accessToken = guestService.getApiKeyAttribute(updateInfo.apiKey, "accessToken");
final Token token = new Token(accessToken, guestService.getApiKeyAttribute(updateInfo.apiKey, "runkeeperConsumerSecret"));
final String userEndpoint = url + accessToken;
OAuthRequest request = new OAuthRequest(Verb.GET, userEndpoint);
request.addHeader("Accept", "application/vnd.com.runkeeper.User+json");
final OAuthService service = runKeeperController.getOAuthService();
service.signRequest(token, request);
Response response = request.send();
final int httpResponseCode = response.getCode();
long then = System.currentTimeMillis();
String body = response.getBody();
if (httpResponseCode==200) {
JSONObject jsonObject = JSONObject.fromObject(body);
String fitnessActivities = jsonObject.getString("fitness_activities");
List<String> activities = new ArrayList<String>();
String activityFeedURL = DEFAULT_ENDPOINT + fitnessActivities;
countSuccessfulApiCall(updateInfo.apiKey, updateInfo.objectTypes, then, request.getCompleteUrl());
getFitnessActivityFeed(updateInfo, service, token, activityFeedURL, 25, activities, since);
Collections.reverse(activities);
getFitnessActivities(updateInfo, service, token, activities);
} else {
countFailedApiCall(updateInfo.apiKey, updateInfo.objectTypes, then,
request.getCompleteUrl(), ExceptionUtils.getStackTrace(new Exception()),
httpResponseCode, body);
if (httpResponseCode==403) {
handleTokenRevocation(body);
}
if (httpResponseCode>=400&&httpResponseCode<500)