使用reviewboard API创建新请求

时间:2012-02-29 02:15:55

标签: java rest review-board

我无法使用rest API 2.0(适用于rb 1.6.3版本)找到任何创建新审核请求的文档。赞赏任何指针。

1 个答案:

答案 0 :(得分:1)

没关系。我通过postreview.py代码弄明白了。这是我写的java等效代码。

private void createRequest(HttpClient httpClient) throws UnsupportedEncodingException, IOException {
    HttpPost post = new HttpPost("http://myreviewboardserver/api/review-requests/");
    List<NameValuePair> data = new ArrayList<NameValuePair>();
    data.add(new BasicNameValuePair("repository", "https://mysvnrepositorypath"));
    post.setEntity(new UrlEncodedFormEntity(data));
    HttpResponse response = httpClient.execute(post);
    HttpEntity entity = response.getEntity();

    entity.writeTo(System.out);
    EntityUtils.consume(entity);
}