Skip to content

Commit 7b16708

Browse files
committed
docs: add web server API documentation
Add basic API documentation for the web server's endpoints, including a disclaimer about backward compatibility (or lack thereof). Also, update the VSCode Markdown settings to use spaces rather than tabs for indentation (to allow for cleaner sub-tab length alignment here and in future patches). Signed-off-by: Victoria Dye <[email protected]>
1 parent f35cf24 commit 7b16708

File tree

2 files changed

+113
-1
lines changed

2 files changed

+113
-1
lines changed

.vscode/settings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// File formatting
33
"[markdown]": {
44
"editor.detectIndentation": false,
5-
"editor.insertSpaces": false,
5+
"editor.insertSpaces": true,
66
"editor.tabSize": 4,
77
"editor.wordWrap": "off",
88
"files.trimTrailingWhitespace": true,

docs/technical/web-server.md

+112
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# Web Server API Reference
2+
3+
This document contains an API specification for the web server created with
4+
`git-bundle-web-server`. It is primarily meant to be used by Git via the
5+
[bundle-uri feature][bundle-uris].
6+
7+
> **Warning**
8+
>
9+
> First and foremost, the goal of this API is compatibility with Git's bundle
10+
> URI feature. We will attempt to keep it up-to-date with the latest version of
11+
> Git but, due to both the newness of the feature and experimental state of the
12+
> server, we cannot make guarantees of backward compatibility.
13+
14+
[bundle-uris]: https://git-scm.com/docs/bundle-uri
15+
16+
## Get a repository's bundle list
17+
18+
Get the list of bundles configured for a given bundle server route.
19+
20+
<table>
21+
<tbody>
22+
<tr>
23+
<th>Method</th>
24+
<td><code>GET</code></td>
25+
</tr>
26+
<tr>
27+
<th>Route</th>
28+
<td><code>/{route}</code></td>
29+
</tr>
30+
<tr>
31+
<th>Example Request</th>
32+
<td><code>curl http://localhost:8080/OWNER/REPO</code></td>
33+
</tr>
34+
<tr>
35+
<th>Example Response</th>
36+
<td>
37+
38+
```
39+
[bundle]
40+
version = 1
41+
mode = all
42+
heuristic = creationToken
43+
44+
[bundle "1678494078"]
45+
uri = REPO/base-1678494078.bundle
46+
creationToken = 1678494078
47+
48+
[bundle "1679527263"]
49+
uri = REPO/bundle-1679527263.bundle
50+
creationToken = 1679527263
51+
52+
[bundle "1680561322"]
53+
uri = REPO/bundle-1680561322.bundle
54+
creationToken = 1680561322
55+
```
56+
57+
</td>
58+
</tr>
59+
</tbody>
60+
</table>
61+
62+
### Path parameters
63+
64+
| Name | Type | Required | Description |
65+
| ------- | ------ | --------- | ----------- |
66+
| `route` | string | Yes | The route of a repository created with `git-bundle-server init` for which we want the list of active bundles. Route should be in `OWNER/REPO` format. |
67+
68+
### HTTP response status codes
69+
70+
| Code | Description |
71+
| ----- | ----------- |
72+
| `200` | OK |
73+
| `404` | Specified route does not exist or has no bundles configured |
74+
75+
## Download a bundle
76+
77+
Download an individual bundle.
78+
79+
<table>
80+
<tbody>
81+
<tr>
82+
<th>Method</th>
83+
<td><code>GET</code></td>
84+
</tr>
85+
<tr>
86+
<th>Route</th>
87+
<td><code>/{route}</code></td>
88+
</tr>
89+
<tr>
90+
<th>Example Request</th>
91+
<td><code>curl http://localhost:8080/OWNER/REPO/bundle-1679527263.bundle</code></td>
92+
</tr>
93+
<tr>
94+
<th>Example Response</th>
95+
<td><i>Binary </i><a href="https://git-scm.com/docs/git-bundle"><code>git bundle</code></a><i> bundle content.</i></td>
96+
</tr>
97+
</tbody>
98+
</table>
99+
100+
### Path parameters
101+
102+
| Name | Type | Required | Description |
103+
| -------- | ------ | --------- | ----------- |
104+
| `route` | string | Yes | The route of a repository containing the desired bundle. |
105+
| `bundle` | string | Yes | The filename of the desired bundle as identified by the `route`'s bundle list. |
106+
107+
### HTTP response status codes
108+
109+
| Code | Description |
110+
| ----- | ----------- |
111+
| `200` | OK |
112+
| `404` | The specified bundle does not exist |

0 commit comments

Comments
 (0)