Hi,
I am using Jira 7.13.0 and Jira base URL is
String urlCAL="[http://192.168.1.236:8082/rest/attach-cat/2/attachments/get?issueKey="+issue](http://192.168.1.236:8082/rest/attach-cat/2/attachments/get?issueKey=%22+issue);
and
try
{
String authString = "vpsvalidator:8c5ydjGL0S8ZiZsODG2JetNqn";
String authStringEnc = Base64.getEncoder().encodeToString(authString.getBytes("utf-8"));
URL url = new URL(urlCAL);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("Accept", "application/json");
conn.setRequestProperty("Authorization", "Basic " + authStringEnc);
if (conn.getResponseCode() != 200)
{
throw new RuntimeException("Failed : HTTP error code : "+ conn.getResponseCode());
}
BufferedReader br = new BufferedReader(new InputStreamReader((conn.getInputStream())));
String output = org.apache.commons.io.IOUtils.toString(br);
Pattern folderpattern = Pattern.compile("\"id\":(.+?),\"name\":\"(.+?)\",\"attachments\":(.+?)]") ;
Matcher foldermatch = folderpattern.matcher(output);
message1 = message1+ output;
while(foldermatch.find())
{
String attachmentsID = foldermatch.group(1);
String attachmentsFolders = foldermatch.group(2);
String attachmentsDetails = foldermatch.group(3);
if(attachmentsFolders.contains(requiredValue))
{
String folderFiles1 =attachmentsDetails.replace("{","");
String folderFiles2 =folderFiles1.replace("[","");
String folderFiles3 =folderFiles2.replaceAll("\"","");
folderFiles =folderFiles3.replace("ids:","");
message1= message1+folderFiles;
}
}
}
catch (Exception e)
{
e.printStackTrace();
throw new InvalidInputException(e+"Unable to Find the Selected folder"+message1+"---"+folderFiles+"==="+requiredValue);
}
then Error shows the HTTP error code: 404 not found.
Does anyone help me?