Hello community I've been trying to update a confluence page from a Jenkins job using curl. Below we can see the pipeline stage that is supposed to take care of it:
stage ('Publish Release Notes')
{
withCredentials([string(credentialsId: 'credentials', variable: 'ATL')]) {
sh(script: "curl -X PUT https://confluence.mycomp.com/rest/api/content/<pageid> -H 'Authorization: Basic ${ATL}' -H 'X-Atlassian-Token: no-check' -H 'Content-Type: application/json' -d @${workspace}/release_notes.json")
}
}
Below we can see the json file contents:
{"id":"<pageid>","type":"page","status":"current","version":{"number":5},"title":"Jenkins Connectivity Test","body":{"storage":{"value":"<ac:layout><ac:layout-section ac:type=\"single\"><ac:layout-cell><p>Second form</p></ac:layout-cell></ac:layout-section><ac:layout-section ac:type=\"two_equal\"><ac:layout-cell><p class=\"auto-cursor-target\"><br></br><br></br></p></ac:layout-cell><ac:layout-cell><p class=\"auto-cursor-target\"><br></br></p><p><br></br></p></ac:layout-cell></ac:layout-section></ac:layout>","representation":"storage","_expandable":{"content":"/rest/api/content/<pageid>"}},"_expandable":{"editor":"","view":"","export_view":"","styled_view":"","anonymous_export_view":""}},"extensions":{"position":"none"},"_links":{"webui":"/display/WKB/Jenkins+Connectivity+Test","edit":"/pages/resumedraft.action?draftId=262088613&draftShareId=42bb8fb1-e467-46d3-b1d0-8f61be65c6d8","tinyui":"/x/pSefDw","collection":"/rest/api/content","base":"https://confluence.ehi.com","context":"","self":"https://confluence.ehi.com/rest/api/content/<pageid>"},"_expandable":{"container":"/rest/api/space/WKB","metadata":"","operations":"","children":"/rest/api/content/<pageid>/child","restrictions":"/rest/api/content/<pageid>/restriction/byOperation","history":"/rest/api/content/262088613/history","ancestors":"","version":"","descendants":"/rest/api/content/<pageid>/descendant","space":"/rest/api/space/WKB"}}
The following error can be observed when run:
HTTP Status 500 – Internal Server Error</h1><hr class="line" /><p><b>Type</b> Exception Report</p><p><b>Message</b> Illegal base64 character 24</p><p><b>Description</b> The server encountered an unexpected condition that prevented it from fulfilling the request.</p><p><b>Exception</b></p><pre>java.lang.IllegalArgumentException: Illegal base64 character 24
19:49:53 java.util.Base64$Decoder.decode0(Base64.java:714)
19:49:53 java.util.Base64$Decoder.decode(Base64.java:526)
19:49:53 java.util.Base64$Decoder.decode(Base64.java:549)
19:49:53 com.atlassian.seraph.util.SecurityUtils.decodeBasicAuthorizationCredentials(SecurityUtils.java:49)
19:49:53 com.atlassian.seraph.auth.DefaultAuthenticator.getUserFromBasicAuthentication(DefaultAuthenticator.java:510)
19:49:53 com.atlassian.seraph.auth.DefaultAuthenticator.getUser(DefaultAuthenticator.java:341)
19:49:53 com.atlassian.seraph.filter.SecurityFilter.doFilter(SecurityFilter.java:139)
19:49:53 com.atlassian.confluence.web.filter.ConfluenceSecurityFilter.applyFilter(ConfluenceSecurityFilter.java:40)
19:49:53 com.atlassian.confluence.web.filter.ConfluenceSecurityFilter.doFilter(ConfluenceSecurityFilter.java:29)
Please let me know what might be causing the issue. Credentials have been tested and they have necessary writing permissions.
Thanks and regards.