Does anyone has any example on how to attach html files on Page in Confluence using Confluence's RESTful API? I'm trying to write something in Java that can do this.
The api exposed by the atlassian is POST /wiki/rest/api/content/{id}/child/attachment but what is {id} here
Suppose my confluence page is https://wiki.company.com/Results/DemoResults/Reports
I made foll request from postman:
POST https://wiki.company.com/rest/api/content/{id}/child/attachment
In params I gave multipart/form-data:object
In authorization I gave my creds and has chosen basic auth as type
In header I gave X-Atlassian-Token: nocheck
I am getting below errors:
{ "statusCode": 500, "message": "", "reason": "Internal Server Error" }
Unable to verify the first certificate
You can't POST arbitrary HTML into a Confluence page because Confluence is not storing its pages in HTML but their own storage format.
If you instead mean to upload the HTML file as an attachment you should use the attachment REST API.
You can use this endpoint :
POST /rest/content/{id}/child/attachment
, hereid
path variable is the page idSee documentation :
https://docs.atlassian.com/atlassian-confluence/REST/6.5.2/