Accessing Withings Web Api from Android

Dylan Segna

I had a lot of trouble getting Withings’ web Api access working in an Android application.
After getting in contact with one of the Withings Api developers, I was finally able to solve the issue.

The problem was that Withings unique OAuth implementation did not work as expected with the OAuth library I was using, Scribe.
After authenticating the user, Scribe was sending all the OAuth information in an Authentication header.
However, Withings was still expecting all this authentication information to remain in the URL query string.

Here’s how I worked around this issue:

This is the basic request sending code.

private Response sendRequest(String resource, String action){
        String URL = apiBase + resource;
	OAuthRequest request = new OAuthRequest(Verb.GET, URL);
	request.addQuerystringParameter("action", action);
	request.addQuerystringParameter("userid", userId);

        Response response = request.send();
	return response;

The resource and action parameters are based on what you are requesting.
They are gotten from Withings Api documentation…

View original post 94 more words


One thought on “Accessing Withings Web Api from Android

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s