-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Medium
-
Component/s: FC - Ecosystem - API Framework
-
3
-
Severity 3 - Minor
Issue Summary
With public pages that contains panels, calling the get content API anonymously (without Authorization and User-Agent headers) will not return body.view.value properly.
It'll contain divs like this.
<div class=\"error\">Error rendering macro 'info' : null</div>
Happens with both V1 and V2 API endpoint
- https://developer.atlassian.com/cloud/confluence/rest/v1/api-group-content/#api-wiki-rest-api-content-get
- https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-page/#api-pages-id-get
Steps to Reproduce
- create a public Confluence page that can be accessed anonymously
- put some panels in the page (info, warning, error)
- make an anonymous API call without "Authorization" and "User-Agent" headers
For V1
curl -H "User-Agent:" 'https://{sitename}.atlassian.net/wiki/rest/api/content/{content_id}?expand=body.view'
For V2
curl -H "User-Agent:" 'https://{sitename}.atlassian.net/wiki/api/v2/pages/{content_id}?body-format=view'
Expected Results
the json response should return proper value in body.view.value (without error)
Actual Results
We get {}Error rendering macro{} error in the response body.view.value
Sample body.view.value data that shows the error.
"<div class=\"error\">Error rendering macro 'info' : null</div><div class=\"error\">Error rendering macro 'info' : null</div><div class=\"error\">Error rendering macro 'warning' : null</div><div class=\"error\">Error rendering macro 'note' : null</div><p />"
Workaround
Adding 'User-Agent' header in the API call will work in returning the correct response.
For V1
curl -H "User-Agent: curl" 'https://{sitename}.atlassian.net/wiki/rest/api/content/{content_id}?expand=body.view'
For V2
curl -H "User-Agent: curl" 'https://{sitename}.atlassian.net/wiki/api/v2/pages/{content_id}?body-format=view'