Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Carlos Wu
Added: Jan 29, 2018 9:41 AM
Modified: Jun 1, 2018 6:37 AM
Views: 17
Tags: httpclient
http://hc.apache.org/httpcomponents-client-ga/tutorial/html/fluent.html

compile group: 'org.apache.httpcomponents', name: 'fluent-hc', version: '4.5.3'
  1. URIBuilder uriBuilder = new URIBuilder(String.format(pulseUri, vendorId));
  2. uriBuilder.addParameter("from", from);
  3. uriBuilder.addParameter("to", to);
  4. uriBuilder.addParameter("limit", String.valueOf(days + 2));
  5.  
  6. String json = Request.Get(uriBuilder.build())
  7.      .addHeader("Authorization", "Bearer " + accessToken)
  8.      .addHeader("Accept", "application/json;charset=utf-8")
  9.      .version(HttpVersion.HTTP_1_1)
  10.      .execute().returnContent().asString();