Search code examples
javacloudant

Is the lists function supported in cloudant java client?


In the cloudant java client (http://www.javadoc.io/doc/com.cloudant/cloudant-client/2.2.0) is this lists function described here supported?

https://cloudant.com/blog/building-custom-dashboards-with-geckoboard-and-cloudant


Solution

  • There are no specific API calls to interact with the _list endpoint in java-cloudant 2.2.0.

    However, it is possible to manually set up a request, so you could try something like:

        // Compose the URI and create a HttpConnection to GET it
    
        URI listRequestURI = new URI(db.getDBUri().toString() 
                                     + "/_design/your-designdoc/_list/your-list/your-view");
    
        HttpConnection listRequest = Http.GET(listRequestURI);
    
        // Execute the request and get the response
    
        HttpConnection listResponse = account.executeRequest(listRequest);
    
        // Get the response in the desired format and process
        listResponse.responseAsString();
        // or responseAsBytes()
        // or responseAsInputStream()