Skip to content

Commit cb4bc47

Browse files
committed
Change documentation to reference /api/v3 endpoint instead of /database/backup endpoint; document authorization token usage
1 parent ce5f556 commit cb4bc47

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

README.MD

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ It originates from [pull request #845](takezoe/gitbucket#845) and can be used to
88

99
### H2 Backup
1010

11-
This plugin allows to backup the underlying H2 database used by default by GitBucket.
11+
This plugin allows you to backup the underlying H2 database used by default by GitBucket.
1212

1313
## Usage
1414

15-
The plugin provides 2 ways to backup the H2 database:
15+
The plugin provides two ways to backup the H2 database:
1616

1717
- via an administration page and a backup button
18-
- via an HTTP call to http://YOUR_GITBUCKET/database/backup
18+
- via an HTTP call to `http://YOUR_GITBUCKET/api/v3/plugins/database/backup
1919

2020
The default backup file points to `GITBUCKET_DATA/backup/gitbucket-db-YYYY-MM-DD-hhmm.zip` where:
2121

@@ -34,13 +34,27 @@ The default backup file points to `GITBUCKET_DATA/backup/gitbucket-db-YYYY-MM-DD
3434

3535
Using your preferred tool (curl, wget, ...) it is possible start a backup of the H2 database.
3636

37-
The URL to call looks like `http://YOUR_GITBUCKET/database/backup`.
37+
The URL to call looks like `http://YOUR_GITBUCKET/api/v3/plugins/database/backup`
3838

39-
You can pass an optional argument `dest` that references the destination file path where the backup will be done on the server. For example calling `http://YOUR_GITBUCKET/database/backup?dest=/var/backups/gitbucket.zip` will do an H2 backup of the gitbucket database into the file `/var/backups/gitbucket.zip`.
39+
You can pass an optional argument `dest` that references the destination file path where the backup will be done on the server.
40+
For example calling `http://YOUR_GITBUCKET/api/v3/plugins/database/backup?dest=/var/backups/gitbucket.zip` will do an H2 backup of the gitbucket database into the file `/var/backups/gitbucket.zip`.
4041
Since `1.3.0`, the _dest_ parameter can denote a relative file path, in this case the file will be created relatively to `GITBUCKET_DATA`.
4142

4243
On success, you will receive a `HTTP 200` answer with a body containing `done: FULL_PATH_OF_BACKUP_FILE`.
4344

45+
### HTTP API Authorization
46+
47+
The api uses token authentication. To generate a token:
48+
49+
1. Login to Gitbucket with an administrative account
50+
2. In the top-right corner, click the user menu
51+
3. Click `Account Settings`
52+
4. On the left, click `Applications`
53+
5. In `Generate new token` enter a description and click `Generate token`
54+
6. Add the token to your http call, such as with `curl`:
55+
56+
`curl -i -H 'Authorization: token your_token_value' http://YOUR_GITBUCKET/api/v3/plugins/database/backup`
57+
4458
## Compatibility
4559

4660
Plugin version | GitBucket version

0 commit comments

Comments
 (0)