I want to consume a GET REST web service from java. It is an HTTPS connection. From postman, I can set the access token and SSL verification false. But if I want to do the same thing from a java class, how can I do that?
- How to make SSL verification false in java?
- How to set the access token in java while making calls to a REST web service?
I am using the below code:
URL url = new URL("https://apigateway.demo.int/demo/application/content");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("Accept", "application/json");
if (conn.getResponseCode() != 200) {
throw new RuntimeException("Failed : HTTP Error code : "
+ conn.getResponseCode());
}