调用confuence api接口 返回的状态码302问题

黑暗的笑 2016-08-16 11:38:00
调用confluence api创建一个一个页面
HttpPost httpPost = new HttpPost("http://xxxxxx/confluence/rest/api/content/");
httpPost.addHeader(HEADER_AUTHORIZATION , AUTHORIZATION_CON);
httpPost.addHeader(HTTP.CONTENT_TYPE , "application/json");
JSONObject obj = new JSONObject();
obj.put("type" , "page").put("title", "picture test").put("space", new JSONObject().put("key", "xxx")).put("body", new JSONObject()
.put("storage", new JSONObject().put("value", "<p>This is a new page</p>").put("representation", "storage")));
HttpResponse res = null;
StringEntity se = null;
try {
se = new StringEntity(obj.toString());
httpPost.setEntity(se);
res = httpClient.execute(httpPost);
System.out.println(res.getStatusLine().getStatusCode());
System.out.println(res.getHeaders("location")[0]);
String entity = EntityUtils.toString(res.getEntity());
System.out.println(entity);
} catch (Exception e) {
e.printStackTrace();
}
调用confuence api接口 返回的状态码302问题
...全文
3446 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

241

社区成员

发帖
与我相关
我的任务
社区描述
欢迎来到Atlassian产品技术交流论坛,您可以从安装/配置/功能/插件等各方面分享JIRA、Confluence、Bamboo等Atlassian系列产品的使用心得、技术难题的解决办法。
社区管理员
  • Atlassian技术社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧