I'm trying to run the Powershell Import HTML-script but I don't have a number that is a book ID.
I cannot seem to find where the ID is present in the GUI of the application. I tried the name of the book as it's written in the URL but that didn't work.
Book ID? #7
@Maltavius It's not something that's specifically exposed in the UI.
You can get IDs using the /api/books endpoint (You can go to that end point in your browser, while logged in as an API-allowed user, since it's just a GET request).
Alternatively, and less officially, you could paste the following into the browser developer console while viewing a book within the interface:
document.querySelector('[option\\:entity-search\\:entity-type="book"]').getAttribute('option:entity-search:entity-id')
Thanks, yes I did figure that out myself. /api/books/ helped,
But now I get
Create-BookstackPage : Cannot process argument transformation on parameter 'Html'. Cannot convert value to type System.String.
At D:\Temp\woxwox\Test\powershell\files-to-pages.ps1:54 char:37
+ Create-BookStackPage $file.Name $fileContent $parentBookId
+ ~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Create-BookstackPage], ParameterBindingArgumentTransformationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,Create-BookstackPage
Not sure about that.
You could maybe try adding the -Raw flag to the previous Get-Content call. Might be the case that I tested on single-line HTML files but PowerShell treats multi-line as an array of some kind.
My knowledge of Powershell is very limited, and keep in mind I wrote this using PowerShell (Core) 7.2.10 on Linux.
As listed in the readme, there is this project which provides a more extensive PowerShell API project.
OK, most of my 800+ HTML-files are 1000+ (Biggest file is 10090) lines exported from Confluence. I need a way to import all of the Confluence Data into BookStack to be able to evaluate it properly, I thought this script might be it.
No due date set.
No dependencies set.
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?