1 # Upload a file attachment to a BookStack page
3 This project will produce an executable "BookStackConsole" binary
4 that takes a path to any local file and attempt
5 to upload it to a BookStack page as an attachment
6 using the API using a multipart/form-data request.
8 **This is very simplistic and has been written with very little c#/.net knowledge, it is only mean to serve as a working example.**
12 You will need .NET installed (Tested on .NET 5.0 on Fedora 35 Linux).
16 First, download all the files in the same directory as this readme to a folder on your system
17 and run the below from within that directory.
21 # ALTERNATIVELY: Open the program.cs file and add to the empty strings in the variables near the top.
22 export BS_URL=https://bookstack.example.com # Set to be your BookStack base URL
23 export BS_TOKEN_ID=abc123 # Set to be your API token_id
24 export BS_TOKEN_SECRET=123abc # Set to be your API token_secret
30 ./BookStackConsole/bin/Debug/net5.0/BookStackConsole <page_id> <file_path>
33 - `<page_id>` - The ID of the page you want to upload the attachment to.
34 - `<file_path>` - File you want to upload as an attachment.
39 # Upload the 'cat-image-collection.zip' file as an attachment to page of ID 205
40 ./BookStackConsole/bin/Debug/net5.0/BookStackConsole 205 ./cat-image-collection.zip