Need help I am trying to connect to XRAY JIRA using Rest API and want to execute a case but getting 400 error response at step inputStream=new InputStreamReader(con.getInputStream(),"UTF-8")
java.io.IOException: Server returned HTTP response code: 400 for URL:
My Code is below:
*HttpURLConnection con=null;
InputStreamReader inputStream=null;
URL jira_API_URL=new URL("https://jira.abc.com/rest/raven/latest/import/execution");
String encodeCredentials=Base64.getEncoder().encodeToString(
"kkris:testjira@234".getBytes("UTF-8"));
con=(HttpURLConnection)jira_API_URL.openConnection();
con.setRequestMethod("POST"); con.setDoOutput(true);
con.setRequestProperty("Autherization", "Basic "+encodeCredentials);
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("X-Atlassian-Token", "nocheck");
try(OutputStream os=con.getOutputStream()){
byte[] input=json.toString().getBytes("UTF-8");
os.write(input,0,input.length);
}
inputStream=new InputStreamReader(con.getInputStream(),"UTF-8");*
Note :Would like to add that I am able to hit this RestAPI using postman and Restassured & able to execute testcase in XRAYJIRA successfully