Hello Experts,
I'm trying to access JIRA project using ZAPI , I'm getting the 403 forbidden error .Below is the code which fetches project list. Below is the code. Any help is highly appreciated. This is completely blocking me to integrate our test automation framework into JIRA
// TODO Auto-generated method stub
DefaultHttpClient defaultHttpClient = new DefaultHttpClient();
StringWriter writer = new StringWriter();
// Define a postRequest request
HttpPost postRequest = new HttpPost("http://jira.serverservices.com/rest/zapi/latest/util/project-list");
// Set the content-type header
postRequest.addHeader("content-type", "application/json");
postRequest.addHeader("Authorization", "Basic a2thbnVtdXJpOmFsbGl*****zJA==");
try {
// Set the request post body
StringEntity userEntity = new StringEntity(writer.getBuffer()
.toString());
postRequest.setEntity(userEntity);
// Send the request; return the response in HttpResponse object if
// any
HttpResponse response = defaultHttpClient.execute(postRequest);
// verify if any error code first
int statusCode = response.getStatusLine().getStatusCode();
System.out.println("Response code received is : +" + statusCode);
BufferedReader r = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
StringBuilder total = new StringBuilder();
String line = null;
while ((line = r.readLine()) != null) {
total.append(line);
}
System.out.println(total.toString());
// is.close();
} finally {
// Important: Close the connect
defaultHttpClient.getConnectionManager().shutdown();
}
Regards,
Kiran