views:

69

answers:

1

Long story short: I'm trying to post comments and create issues onto Google Code via an Android App called Abugadro.

I followed a very similar piece of code here: http://stackoverflow.com/questions/3254330/google-spreadsheet-api-update-edit-with-protocol

When trying to post a comment onto the API, I've gotten various errors like 403 and 501 depending on the headers I use.

Anyway, Code talks, so here's my piece:

HttpPost postRequest = new HttpPost("http://code.google.com/feeds/issues/p/"+projName+"/issues/"+issueId+"/comments/full");

postRequest.addHeader("Content-Type","application/atom+xml;charset=UTF-8");
postRequest.setHeader("Authorization", "GoogleLogin auth=" + auth);
postRequest.addHeader("User-Agent", "abugadro-v"+getResources().getString(R.string.version));
postRequest.addHeader("Accept-Encoding","gzip");
postRequest.addHeader("GData-Version", "1.0");
//postRequest.addHeader("If-Match", "*");//Not entirely sure if I should use this or not

HttpEntity se = new StringEntity(xml,"UTF-8"); //Contains the comment info              
postRequest.setEntity(se);

The IssueTrackerAPI is very vague on what sort of headers I should be using to post correctly. http://code.google.com/p/support/wiki/IssueTrackerAPI#Modifying_an_issue_or_creating_issue_comments

P.S. I know there's a gdata-java-client but there's no sane way to use that api on android without dragging ~2mb of jars.

I really appreciate your help, this issue has been driving me insane beyond comprehension. Thanks again.

A: 

The best Android library for Google API's is the google-api-java-client, which supports Android. gdata-java-client doesn't support Android.

google-api-java-client supports the Issue Tracker API, but there is no sample for it yet. Please make a request for a sample. Meanwhile, you can take a look some of the other examples written for Android like picasa-atom-android-sample or calendar-v2-atom-android-sample.

Yaniv Inbar
I'll definitely check it out Yaniv, and if I actually get it to work, I'll write the sample myself. Deal? :D
Nushio
That would be great, thanks!
Yaniv Inbar