Skip to content
Android REST client library (supports RESTful JSON API)
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
libs
src/com/kodart/httpzoid fix inputstream expectation Jul 22, 2013
AndroidManifest.xml Update AndroidManifest.xml Jul 11, 2013
Httpzoid.iml
README.md
ant.properties First commit Jul 9, 2013
local.properties First commit Jul 9, 2013
proguard-project.txt First commit Jul 9, 2013
project.properties

README.md

Httpzoid - Android REST (JSON) Client

Overview

Httpzoid is designed to provide a simple way to deal with REST requests. Requests are asynchronous, callback handler runs in UI thread.

Quick start

This sample will make a post request to the specified url and send User object in JSON format.

Http http = HttpFactory.create(context);
http.post("http://example.com/users")
    .data(new User("John"))
    .send();

Request with callbacks.

Http http = HttpFactory.create(context);
http.post("http://example.com/users")
    .data(new User("John"))
    .handler(new ResponseHandler<Void>() {
        @Override
        public void success(Void ignore, HttpResponse response) {
        }

        @Override
        public void error(String message, HttpResponse response) {
        }

        @Override
        public void failure(NetworkError error) {
        }

        @Override
        public void complete() {
        }
    }).send();

Httpzoid works with objects or stream directly

Http http = HttpFactory.create(context);
http.get("http://example.com/users")
    .handler(new ResponseHandler<User[]>() {
        @Override
        public void success(User[] users, HttpResponse response) {
        }
    }).send();

InputStream input = new FileInputStream("avatar.jpg");
http.post("http://example.com/users/1/avatar")
    .data(input)
    .handler(new ResponseHandler<Void>() {
        @Override
        public void complete() {
            input.close();
        }
    }).send();
You can’t perform that action at this time.