How do you post a comment to Atlassian confluence using their REST api?

confluence, confluence-rest-api, rest

Solution

this should work:

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

Problem

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" } ```

Original source