Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set-Confluence failing with "com.atlassian.confluence.api.service.exceptions.BadRequestException: Content body cannot be converted to new editor" #184

Open
dprice opened this issue Jul 28, 2020 · 0 comments

Comments

@dprice
Copy link

dprice commented Jul 28, 2020

Description

I have custom scripts that convert a CSV file to markdown then to html which is imported into Confluence using ConfluencePS. The call to Set-ConfluencePage, produces this error:

WARNING: Confluence returned HTTP error 400 - BadRequest
Invoke-ConfluenceMethod: C:\Users\34160\Documents\PowerShell\Modules\ConfluencePS\2.5.0\ConfluencePS.psm1:1963:13
Line |
1963 |              Invoke-Method @iwParameters
     |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | com.atlassian.confluence.api.service.exceptions.BadRequestException: Content body cannot be
     | converted to new editor format

NOTE: This was working the other day

Steps To Reproduce

Based on sample code, this is how I use the ConfluencePS module:

  1. I set my credentials:
    $pword = ConvertTo-SecureString -String $AtlassianToken -AsPlainText -Force
    $cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $UserName, $pword
    Set-ConfluenceInfo -BaseURI $WikiUri -Credential $cred
  1. Convert CSV to Markdown to Html and save the html to a file all using native PowerShell commands (not shown).
  2. Get the confluence page via Get-ConfluencePage -PageID $page.Id
  3. Update the page. This is where the error occurs:
$html = Get-Content $HtmlFile -Raw
$newPage = Set-ConfluencePage -PageID $page.Id -Body $html

Expected behavior

Not get this error :)

Screenshots

N/A

Your Environment

Using ConfluencePS version 2.5.0 with PowerShell 7.0.3 on Window 10:

❯ Get-Module ConfluencePS -ListAvailable | Select Name, Version

Name         Version
----         -------
ConfluencePS 2.5.0

⚡ 34160@FRT0919PF1E9AYY  ~                                                                                                                                                                                              [11:00]
❯ $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.0.3
PSEdition                      Core
GitCommitId                    7.0.3
OS                             Microsoft Windows 10.0.19041
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Possible Solution

This seems to be a know issue related to a missing ri:space-key parameter when getting the page:
https://jira.atlassian.com/browse/CONFCLOUD-69902

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant