如何使用Atlassian Confluence的REST API发表评论?

4
我将尝试使用REST API自动向Confluence页面添加评论。
我正在使用Postman进行测试,指向此URL:https://###########.atlassian.net/wiki/rest/api/content/ 使用有效的标题,并发布以下JSON:
{  
    "type":"comment",
    "container":"72025106",
    "body":{  
        "storage":{  
            "value":"auto comment 1",
            "representation":"storage"
        }
    }
}

当我执行时,会收到以下错误信息:
{
    "statusCode": 500,
    "message": "java.lang.IllegalStateException: Must provide id and type for Content"
}
1个回答

6

这应该可以工作:

{"type":"comment",
   "container":{
       "id":"[PARENT_ID]",
       "type":"page",
       "status":"current"
   },
   "body":{
      "storage":{
         "value":"[COMMENT_BODY]",
         "representation":"storage"
      }
   }
}

这个 JSON 对我来说实际上是有效的,Confluence 的 REST 文档是错误的! - theRightTool

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接