How do you post a comment to Atlassian confluence

2019-06-02 05:57发布

I'm trying to automatically add a comment to a page in confluence using the REST API.

I am testing using Postman, im pointing at this url: https://###########.atlassian.net/wiki/rest/api/content/

using valid headers, and posting this json:

{  
    "type":"comment",
    "container":"72025106",
    "body":{  
        "storage":{  
            "value":"auto comment 1",
            "representation":"storage"
        }
    }
}

When I do i get this error back:

{
    "statusCode": 500,
    "message": "java.lang.IllegalStateException: Must provide id and type for Content"
}

1条回答
ら.Afraid
2楼-- · 2019-06-02 06:37

this should work:

{"type":"comment",
   "container":{
       "id":"[PARENT_ID]",
       "type":"page",
       "status":"current"
   },
   "body":{
      "storage":{
         "value":"[COMMENT_BODY]",
         "representation":"storage"
      }
   }
}
查看更多
登录 后发表回答