I am trying to update a page using the Rest API and powershell in confluence
I am able to pull the page and data using:
Invoke-WebRequest https://myconfluence.com/rest/api/content/<page_id> -Header @{Authorization = 'Bearer <'mytoken'>}
To update the page, this is what I'm trying but I keep getting The remote server returned an error: (400) Bad Request.
Invoke-WebRequest -Method 'PUT' https://myconfluence/rest/api/content/<page_id> -UseBasicParsing -Header @{Authorization = 'Bearer <mytoken>' ; "Content-Type" = "application/json" } -Body '{ "status":"current", "version":{"number": 2}, "type": "page", "title":"existing_title", "body":{"storage":{"value":"<html> <head></head> <body> <p class=\"auto-cursor-target\"><br></p> <table class=\"wrapped\"> <colgroup> <col> <col> <col> <col> </colgroup> <tbody> <tr> <th>Col1</th> <th>Col2</th> <th colspan=\"1\">Col3</th> <th colspan=\"1\">Col4</th> </tr> <tr> <td>V1</td> <td>V2</td> <td colspan=\"1\">N/A</td> <td colspan=\"1\">N/A</td> </tr> <tr> <td>Q1</td> <td>N/A</td> <td colspan=\"1\">N/A</td> <td colspan=\"1\">N/A</td> </tr> </tbody> </table> <p class=\"auto-cursor-target\"><br></p> </body></html>", "representation":"storage"}}}'
I found my problem
representation should be set to: "editor"
@JiraAdminTest @Can you please explain it clearly
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.