]> BookStack Code Mirror - api-scripts/blob - rust-list-all-pages/readme.md
Added bsfs to community project list
[api-scripts] / rust-list-all-pages / readme.md
1 # List All Pages
2
3 This project, written in [Rust](https://www.rust-lang.org/), will list out all pages in a BookStack instance in the following format:
4
5 ```txt
6 ID=1; Name=My Page
7 ID=2; Name=Another Page
8 ID=3; Name=Custom Homepage page
9 ...
10 ```
11
12 Note: This is only provided as an example. The project lacks full error handling, performing non-sync blocking requests & timeouts, and was written with only beginner rust knowledge.
13
14 ## Requirements
15
16 Rust, and it's tooling, is required to build this project. 
17 You will also need BookStack API credentials at the ready.
18
19 This was built with the following versions:
20
21 - cargo 1.61.0 (a028ae4 2022-04-29)
22 - rustc 1.61.0 (fe5b13d68 2022-05-18)
23
24 ## Running & Building
25
26 ```bash
27 # Clone down the api-scripts repo and enter this directory
28 git clone https://github.com/BookStackApp/api-scripts.git
29 cd api-scripts/rust-list-all-pages
30
31 # Run the project
32 cargo run
33
34 # Build and run the project
35 cargo build -r
36 ./target/release/rust-list-all-pages
37 ```
38
39 ## API Configuration
40
41 You'll need to provide your API credentials for this application to find and access your BookStack instance.
42 By default, it will look for `BS_URL`, `BS_TOKEN_ID`, `BS_TOKEN_SECRET` environment variables.
43 You can expose this within your current shell environment by using something like the below:
44
45 ```bash
46 export BS_URL=https://bookstack.example.com # Set to be your BookStack base URL, excluding any trailing `/api`
47 export BS_TOKEN_ID=abc123 # Set to be your API token_id
48 export BS_TOKEN_SECRET=123abc # Set to be your API token_secret
49 ```
50
51 Alternatively, before building/running, you could edit the `src/main.rs` file and edit the values in the `ApiCredentials::from_env` function to hard-code your values.
Morty Proxy This is a proxified and sanitized view of the page, visit original site.