Skip to content

A REST client implementation designed for Android to increase productivity when consuming web services.

Notifications You must be signed in to change notification settings

chouex/RESTclient-Android

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

RESTclient-Android

This library is designed to greatly assist consuming RESTful webservices. Originally I started by using the library listed in the contributions. I then modified to DRY up the script, added PUT and DELETE verbs, HTTP basic authentication, and a JSON body.

Usage

The code below is an example using a GET request to grab JSON from the server

RestClient client = new RestClient(webServiceUrl);
client.addBasicAuthentication(username, password);
try {
	client.execute(RequestMethod.GET);
	if (client.getResponseCode() != 200) {
		//return server error
		return client.getErrorMessage();
	}
	//return valid data
	JSONObject jObj = new JSONObject(client.getResponse());
	return jObj.toString();
} catch(Exception e) {
	return e.toString();
}

Contributions

http://lukencode.com/2010/04/27/calling-web-services-in-android-using-httpclient/

##RESTclient-Example This example uses a service to consume a webservice in the background and update the activity if its in use, or store the data for the next time the user is active.

License

Release under the Apache 2 license.

About

A REST client implementation designed for Android to increase productivity when consuming web services.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published