开发者

Help with Google Code Issue Tracker API

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: 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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜