Data Poa Client Library for Java
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Datapoa Java Client Library

Build Status Maven Central

The DataPoa Client Library for Java is a flexible, efficient, and powerful Open Source Java client library for accessing Porto Alegre's open data.

About #DataPoa

The #DataPoa is a portal with open data from Porto Alegre, Brazil. It has the main goal to bring the community to use this data to create smart solutions for the city.

About Data

This API has a lot of different kind of data like Mobility, Heath, Education and others.

DataPoa Portal

DataPoa API


Add this library as dependency with Gradle or Maven:


  compile ''



Accessing API from Porto Alegre Open Data

To access data from DataPoa API with this library you will need use DataClient as below:

    DataResourceBuilder builder = new DataResourceBuilder().resource(resourceId);
    DataResource dpResource =;
    DataEntity data = new DataClient(dpResource).doRequest();

    for (JsonObject record : data.getResult().getRecords()) {

Examples can be found on Unit Tests

Creating Customized Results

We made this library to be flexible. Then you can extend DataEntity.class and implement your customized result. Using DataClient:

    DataClient client = new DataClient(dpResource);
    CustomizedResultEntity result = client.doRequest(CustomizedResultEntity.class);

More details can be found on Unit Tests.

Executing Asynchronous Requests

To execute a request asynchronous you must to create a callback class implementing IDataRequestAsyncCallback interface and sending it to DataClient:

    MyCallback callback = new MyCallback();
    DataResourceBuilder builder = new DataResourceBuilder().resource(resourceId);
    DataResource dpResource =;
    new DataClient(dpResource).doAsyncRequest(DataEntity.class, callback);

More details can be found on Unit Tests.

Getting Request Exceptions

When an error occur during the request it will raise a DataRequestException with the point where error occurred

    try {
        data = new DataClient(dpResource).doRequest();
    } catch (DataRequestException e) {
        int point = e.getPointWhenErrorOccurred();

        switch (point) {
            case DataRequestException.WHEN_REQUESTING_DATA:
            case DataRequestException.WHEN_PARSING_DATA:
            case DataRequestException.WHEN_POSTING_DATA:

More details can be found on Unit Tests.

How can I get Resource ID?

Access DataPoa Portal and pick one data set. Enter in "Explorar"and "API Dados" in this page you'll be able to figure out the Resource Id.

#Build and Run

The easiest way to build this library is with Gradle but you can pick your own way to do it.

     $ git clone
     $ cd datapoa-java-client
     $ gradle build


  • As User

    1. Create New Features Issues
    2. Create Bug Issues
  • As Developer

    1. Fork it!
    2. Create your feature branch: git checkout -b my-new-feature
    3. Commit your changes: git commit -am 'Add some feature'
    4. Push to the branch: git push origin my-new-feature
    5. Submit a pull request

IMPORTANT: Pull requests should have Unit Tests.


This project is under MIT License.

Authors / Contributors

Cristian Oliveira - (