Confluence API: How do I get the author of a comment?

Hey,

I am able to get the content of a page and the list of the comments, but apparently the comments themselves don’t have any information about the author. I also tried adding the “history.contributors” parameter to the API call (/content/%s/child/comment?expand=body.export_view&history.contributors&location=footer) to no avail…

I think I might also have the same problem with the content author itself: what’s the logic to get a content’s author then?

Thanks

1 Like

Hey @ClaudioCicali, sorry for bumping an old thread but I ended up here after also trying to get comment authors from the Confluence API.

It’s possible to retrieve the comment author by including the history parameter to expand. The resulting payload contains a history object in each comment which looks like this:

"history": {
    "createdBy": {
        "type": "known",
        "accountId": "<accountId>",
        "accountType": "atlassian",
        "email": "<email>",
        "displayName": "<display name>",
        "isExternalCollaborator": false,
    },
    "createdDate": "2021-11-14T12:26:46.248Z",
}

I believe the issue with your query is that the expand parameter should contain a comma-separated list of items to expand, so instead of ?expand=body.export_view&history.contributors it should be ?expand=body.export_view,history.contributors

(or in this case ?expand=body.export_view,history should suffice)