Confluence inline comments REST API does not return the comment message

Hi,

I’m creating a Forge app and want to get all the inline comments.

I’m using https://mysite.atlassian.net/wiki/api/v2/pages/45187074/inline-comments to fetch the comments of a page with id 45187074

This is what I get in return:

`"results": [
        {
            "id": "45973506",
            "status": "current",
            "title": "Re: Frietei",
            "pageId": "45187074",
            "version": {
                "number": 1,
                **"message": "",**
                "minorEdit": false,
                "authorId": "557058:fbbb56de-c97c-4b68-8216-2e193b8dffdc",
                "createdAt": "2024-03-04T14:40:26.478Z"
            },
            "resolutionStatus": "resolved",
            "resolutionLastModifierId": "557058:fbbb56de-c97c-4b68-8216-2e193b8dffdc",
            "resolutionLastModifiedAt": "2024-03-05T15:05:33.526Z",
            "properties": {
                "inlineMarkerRef": "e4605da7-0e5f-4103-8b6f-b947d6a36be4",
                "inlineOriginalSelection": "eierbal",
                "inline-original-selection": "eierbal",
                "inline-marker-ref": "e4605da7-0e5f-4103-8b6f-b947d6a36be4"
            },
            "_links": {
                "webui": "/spaces/~557058fbbb56dec97c4b6882162e193b8dffdc/pages/45187074/Frietei?focusedCommentId=45973506"
            }
        },
        {...}
]`

As you can see, the message is empty (this is for all the comments). While I would expect to get the message content. Is this a bug or should I add an expand or do I need to use a different end-point?

(By the way the above is fetched with Postman)

Thanks,
Rudy

Hi @rudy.holtkamp ,

The problem here is not that the message is empty, but that the comment(s) body is not returned at all.

I was able to reproduce the reported behavior and I found out that the inline comments body is only returned by this endpoint when providing the body-format parameter to the request. Therefore, I proceeded creating below bug ticket on your behalf:

Please review above bug ticket and let me know if appending the body-format parameter to the request URL works for you too.

Cheers,
Dario

1 Like

Hi @Dario_B ,
Thanks for responding, with the expand I do can get the body text, so that will help me out.
Though I don’t understand what the message fields is, could you explain it?

And are there more (undocumented) expands in the REST API or is this due to the change from v1 to v2?

Cheers,
Rudy

Hi @rudy.holtkamp ,

Please notice that’s not an undocumented expand, but a very well documented query parameter that is not working as expected:


Indeed, as you can see in above screenshot, the parameter is not marked as required and it's never mentioned anywhere that you need to provide it in order to have the inline comments body returned.

Plus, as mentioned in the provided bug ticket, the same parameter is not needed to return the inline comments body when using the very similar REST API endpoint to Get inline comments for blog post (GET /blogposts/{id}/inline-comments).


For the rest, as regarding the message field, I am not sure about it so I will go ask for confirmation to the Confluence Cloud dev team. However, looking at the structure and format, it seems to be meant to be used for the “commit message” you can add to describe the changes performed when you save the new version of a page (like in below screenshots), but it’s weird it’s here since you cannot add any description/commit message when editing an inline comment (the version number is increased automatically every time you modify and save the comment).

Screenshot 2024-03-07 at 16.40.25


Anyway, once again, since I am not sure about the last part please bear with me while I ask the Confluence dev team.

Cheers,
Dario

2 Likes

Hi there,

I already got confirmation that my guess was indeed correct and that the field cannot be set from the UI:

The “message” field returned by the REST API endpoint Get inline comments for page (GET /pages/{id}/inline-comments) is intended to be used to save a commit message describing what changed when saving a new version of the comment. This field is not settable from the UI.


The commit message can only be set when using the Update inline comment REST API endpoint (PUT
/inline-comments/{comment-id}) as described in the provided example:

curl --request PUT \
  --url 'https://{your-domain}/wiki/api/v2/inline-comments/{comment-id}' \
  --user 'email@example.com:<api_token>' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
  "version": {
    "number": 78,
    "message": "<string>"
  },
  "body": {
    "representation": "storage",
    "value": "<string>"
  },
  "resolved": true
}'

Please let me know if there are still open questions or if this thread can be marked as resolved.

Cheers,
Dario

1 Like

Everything is crystal clear, thanks for explaining!

:+1: