Make GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS requests using UniRest

  • GET:
    final HttpResponse<String> response = Unirest.get("http://httpbin.org/get").asString();    System.out.println( response.getBody() );
  • POST:
  HttpResponse<String> jsonResponse = Unirest.post("http://httpbin.org/post")      .header("accept", "application/json")      .queryString("apiKey", "123")      .field("parameter", "value")      .field("foo", "bar")      .asString();  System.out.println( response.getBody() );
  • PUT:
    final HttpResponse<String> response = Unirest.put(“http://httpbin.org/put").asString();    System.out.println( response.getBody() );
  • DELETE:
    final HttpResponse<String> response = Unirest.delete("http://httpbin.org/delete").asString();    System.out.println( response.getBody() );
  • HEAD:
    final HttpResponse<String> response = Unirest.head("http://httpbin.org/head").asString();    System.out.println( response.getBody() );