This is my code . I am trying to do a post on the rest Api from android (API 10)
HttpPost httpPost = new HttpPost(
"http://www.reactomews.oicr.on.ca:8080/ReactomeRESTfulAPI/RESTfulWS/queryHitPathways");
httpPost.addHeader("Accept", "application/json");
httpPost.addHeader("Content-Type"," text/plain; charset=UTF-8");
httpPost.addHeader("","PPP2R1A,CEP192,AKAP9,CENPJ,CEP290,DYNC1H1");
try {
HttpResponse response = client.execute(httpPost);
StatusLine statusLine = response.getStatusLine();
int statusCode = statusLine.getStatusCode();
if (statusCode == 200) {
HttpEntity entity = response.getEntity();
InputStream content = entity.getContent();
BufferedReader reader = new BufferedReader(
new InputStreamReader(content));
String line;
while ((line = reader.readLine()) != null) {
builder.append(line);
}
} else {
System.out.println(statusCode);
Log.e(Gsearch.class.toString(), "Failed to download file");
}
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return builder.toString();
}
I just don't know what to add (as the first string)in the last addHeader method ! I tried "name", "ID" etc. Its not listed in the API too. The API documentation is here : http://reactomews.oicr.on.ca:8080/ReactomeRESTfulAPI/ReactomeRESTFulAPI.html I tried to use firebug to see the post request in browser but it says post data = "PPP2R1A,CEP192,AKAP9,CENPJ,CEP290,DYNC1H1" .
Right now I am using "body" in there and I am getting a json respnse of length 0 . But if i try on browser from the documentation link , I get a json response. so the error is in the addHeader part.