Package com.fitbit.api

Examples of com.fitbit.api.FitbitAPIException


        // Example: DELETE /1/user/-/bp/123.json
        String url = APIUtil.contextualizeUrl(getApiBaseUrl(), getApiVersion(), "/user/-/bp/" + logId, APIFormat.JSON);
        try {
            httpDelete(url, true);
        } catch (Exception e) {
            throw new FitbitAPIException("Error deleting water: " + e, e);
        }
    }
View Full Code Here


        try {
            Response res = httpPost(url, params.toArray(new PostParameter[params.size()]), true);
            return new Glucose(res.asJSONObject());
        } catch (FitbitAPIException e) {
            throw new FitbitAPIException("Error logging glucose: " + e, e);
        } catch (JSONException e) {
            throw new FitbitAPIException("Error logging glucose: " + e, e);
        }
    }
View Full Code Here

        Response res = httpGet(url, true);
        throwExceptionIfError(res);
        try {
            return new Glucose(res.asJSONObject());
        } catch (JSONException e) {
            throw new FitbitAPIException("Error retrieving blood pressure: " + e, e);
        }
    }
View Full Code Here

        try {
            Response res = httpPost(url, params.toArray(new PostParameter[params.size()]), true);
            return new HeartLog(res.asJSONObject().getJSONObject("heartLog"));
        } catch (FitbitAPIException e) {
            throw new FitbitAPIException("Error logging heart rate: " + e, e);
        } catch (JSONException e) {
            throw new FitbitAPIException("Error logging heart rate: " + e, e);
        }
    }
View Full Code Here

        Response res = httpGet(url, true);
        throwExceptionIfError(res);
        try {
            return new Heart(res.asJSONObject());
        } catch (JSONException e) {
            throw new FitbitAPIException("Error retrieving heart rate: " + e, e);
        }
    }
View Full Code Here

        // Example: DELETE /1/user/-/heart/123.json
        String url = APIUtil.contextualizeUrl(getApiBaseUrl(), getApiVersion(), "/user/-/heart/" + logId, APIFormat.JSON);
        try {
            httpDelete(url, true);
        } catch (Exception e) {
            throw new FitbitAPIException("Error deleting heart rate: " + e, e);
        }
    }
View Full Code Here

        try {
            Response response = httpGet(url, true);
            throwExceptionIfError(response);
            return new UserInfo(response.asJSONObject());
        } catch (FitbitAPIException e) {
            throw new FitbitAPIException("Error getting user info: " + e, e);
        } catch (JSONException e) {
            throw new FitbitAPIException("Error getting user info: " + e, e);
        }
    }
View Full Code Here

        try {
            Response response = httpPost(url, params.toArray(new PostParameter[params.size()]), true);
            throwExceptionIfError(response);
            return new UserInfo(response.asJSONObject());
        } catch (FitbitAPIException e) {
            throw new FitbitAPIException("Error updating profile: " + e, e);
        } catch (JSONException e) {
            throw new FitbitAPIException("Error updating profile: " + e, e);
        }
    }
View Full Code Here

        Response response = httpPost(url, params.toArray(new PostParameter[params.size()]), true);

        try {
            return new SleepLog(response.asJSONObject().getJSONObject("sleep"));
        } catch (JSONException e) {
            throw new FitbitAPIException("Error parsing json response to SleepLog object: ", e);
        }
    }
View Full Code Here

        throwExceptionIfError(response);

        try {
            return UserInfo.friendJsonArrayToUserInfoList(response.asJSONObject().getJSONArray("friends"));
        } catch (JSONException e) {
            throw new FitbitAPIException("Error parsing json response to list of UserInfo : ", e);
        }
    }
View Full Code Here

TOP

Related Classes of com.fitbit.api.FitbitAPIException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.