簡単に言うと、コメントを投稿し、Abugadro という Android アプリを介して Google Code に問題を作成しようとしています。
ここで非常によく似たコードをたどりました: Google Spreadsheet API update \ edit with protocol
API にコメントを投稿しようとすると、使用するヘッダーに応じて 403 や 501 などのさまざまなエラーが発生します。
とにかく、コードは話すので、ここに私の作品があります:
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);
IssueTrackerAPI は、正しく投稿するためにどのような種類のヘッダーを使用する必要があるかについて非常に曖昧です。 http://code.google.com/p/support/wiki/IssueTrackerAPI#Modifying_an_issue_or_creating_issue_comments
PS gdata-java-client があることは知っていますが、2 MB の jar をドラッグせずに Android でその API を使用する適切な方法はありません。
私はあなたの助けに本当に感謝しています.この問題は私を理解できないほど狂わせています. 再度、感謝します。