Don’t have any reference links if you want you can refer below sample which i roughly did
Below code is for GET method
function will accept URL and headers and return response
String[] get(String url, Map<String,String> headers) throws IOException {
client = new OkHttpClient.Builder().connectTimeout(120, TimeUnit.SECONDS)
.writeTimeout(120, TimeUnit.SECONDS).readTimeout(120, TimeUnit.SECONDS)
.followRedirects(true).followSslRedirects(true).
build();
response_received= new String[3];
Request.Builder builder = new Request.Builder()
.url(url).header(“User-Agent”, “Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19”);
headers.forEach((key,value)->builder.addHeader(key, value));
Request request = builder.build();
System.out.println(ExecutionLogGenerator.Logger(classname)+"–> HTTP GET “+ url);
try (Response response = client.newCall(request).execute()){
System.out.println(ExecutionLogGenerator.Logger(classname)+”<-- HTTP “+response.code()+” “+url+” [Success : “+ response.isSuccessful()+”]"+" [Message :"+ response.message()+"]");
response_received[0]= String.valueOf(response.code());
response_received[1]= response.message();
response_received[2]= response.body().string();
return response_received;
}
}
but comparison its based on requirement you can go through the samples given here
https://github.com/json-path/JsonPath you will find something suitable for your requirement.