Open em3697 opened 1 year ago
Do you mean incline comments added to the sections of the page or separate comment that are visible below the main page section? 1) get_page_by_id api callshould include content of the page including incline comments added to the main page 2) get_page_comments is a separate endpoint used to get a list of comments that are visible below the page as per https://developer.atlassian.com/cloud/confluence/rest/v1/api-group-content-comments/#api-wiki-rest-api-content-id-child-comment-get
@gkowalc the get_page_comments is the endpoint I was looking for, but I don't see the comment body. Am I missing something?
@gkowalc I now have the comment body using expand="body.view.value" - Is there a similar expand option for viewing any information about the author as well?
@gonchik I see you're active on some issues - are you able to offer any information on this? I've tried several expand options with no luck finding comment author information.
Hello @em3697, I looked closer at the endpoint get_page_by_id and came to following conclusions:
confluence_object = Confluence(username=username, url=server,password=api_key)
output = json.dumps(confluence_object.get_page_by_id(<my_page_id>, indent=4)
if you look at the expandable fields you will have some options in the space, version json key, and also in the 'metadata. If you add expand flag to metadata:
confluence_object = Confluence(username=username, url=server,password=api_key)
output = json.dumps(confluence_object.get_page_by_id(<my_page_id> , expand="metadata"), indent=4)
"metadata": {
"_expandable": {
"currentuser": "",
"comments": "",
"sourceTemplateEntityId": "",
"simple": "",
"properties": "",
"frontend": "",
"labels": "",
"likes": ""
}
For example when I tried to expand to metadata.comments:
confluence_object = Confluence(username=username, url=server,password=api_key)
output = json.dumps(confluence_object.get_page_by_id(<my_page_id> , expand="metadata.comment"), indent=4)
I didn't get anything even though I have a comment on my sample page. I think it is limitation of this API endpoint.
So I would just use additional API call to get_page_comments to get comments added to the page and then combine it with the outptut from previous get_page_by_id call. Note: By comments, I meant comments added to the bottom of the page. For inline comments (comments added to piece of text) you can try expand field: expand="extensions.inlineProperties" but it is not possible to get the full content of incline comments due to the API limitation: https://jira.atlassian.com/browse/CONFSERVER-43583 Does it make sense?
Is there a way to include comments when calling get_page_by_id? Maybe using the expand parameter? I haven't been able to find anything for retrieving comments, only creating them.