public FutureAPIResponse sendQueryAsFuture ( Map < String , Object > query ) throws ExecutionException , InterruptedException , IOException { RequestBuilder builder = new RequestBuilder ( "POST" ) ; builder . setUrl ( apiUrl + "/queries.json" ) ; // handle DateTime separately GsonBuilder gsonBuilder = new GsonBuilder ( ) ; gsonBuilder . registerTypeAdapter ( DateTime . class , new DateTimeAdapter ( ) ) ; Gson gson = gsonBuilder . create ( ) ; String requestJsonString = gson . toJson ( query ) ; builder . setBody ( requestJsonString ) ; builder . setHeader ( "Content-Type" , "application/json" ) ; builder . setHeader ( "Content-Length" , "" + requestJsonString . length ( ) ) ; return new FutureAPIResponse ( client . executeRequest ( builder . build ( ) , getHandler ( ) ) ) ; }
Sends a query asynchronously .