diff options
author | Drew DeVault <sir@cmpwn.com> | 2020-02-14 17:21:55 -0500 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2020-02-14 17:21:55 -0500 |
commit | bd0fa833ff2a8cd18467603098eb4955899b38ac (patch) | |
tree | f57e55e94acb3a5a23d88aab85106e593ae58599 /git.sr.ht | |
parent | 7b99d0401f097c9233e9b296cfef761df3f281c1 (diff) | |
download | sr.ht-docs-bd0fa833ff2a8cd18467603098eb4955899b38ac.tar.gz |
git.sr.ht API: document file artifacts
Diffstat (limited to 'git.sr.ht')
-rw-r--r-- | git.sr.ht/api.md | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/git.sr.ht/api.md b/git.sr.ht/api.md index a8af516..25ade31 100644 --- a/git.sr.ht/api.md +++ b/git.sr.ht/api.md @@ -6,6 +6,13 @@ The git.sr.ht API allows you to browse, create, and manage repositories on git.sr.ht programmatically. This API follows the [standard sourcehut API conventions](../api-conventions.md). +**Notice**: the git.sr.ht API is due for an overhaul in the foreseeable future; +be prepared for it to change. The changes will be announced in advance on the +[sr.ht-announce][announce] and [sr.ht-discuss][discuss] mailing lists. + +[announce]: https://lists.sr.ht/~sircmpwn/sr.ht-announce +[discuss]: https://lists.sr.ht/~sircmpwn/sr.ht-discuss + ## Authentication Authentication is done via the [meta.sr.ht OAuth @@ -27,6 +34,23 @@ git interface. git.sr.ht supports the [smart protocol][protocols] over HTTPS ## Resources +### Artifact resource + +```json +{ + "created": "timestamp", + "checksum": "checksum (string)", + "size": integer (bytes), + "filename": "string", + "url": "url" +} +``` + +Note: the checksum format is "algorithm:checksum". Presently the only supported +algorithm is sha256. + +Example: "`sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855`" + ### Commit resource ```json @@ -74,7 +98,8 @@ git interface. git.sr.ht supports the [smart protocol][protocols] over HTTPS ```json { "name": "name of reference (e.g. refs/heads/master)", - "target": "reference target (sha-1 hash)" + "target": "reference target (sha-1 hash)", + "artifacts": [ list of artifact resources ] } ``` @@ -193,6 +218,18 @@ List of the latest [commit resources](#commit-resource) on the default branch. **OAuth scope**: `data:read` +### POST /api/repos/:name/artifacts/:ref + +Equivalent to [/api/:username/repos/:name/artifacts/:ref](#POST-apiusernamereposnameartifactsref), +implies the authenticated user. + +### POST /api/repos/:username/repos/:name/artifacts/:ref + +Attaches a file artifact to the specified ref. + +**Note**: this endpoint does *not* accept JSON. Submit your request as +`multipart/form-data`, with a single field: "file". + ### GET /api/repos/:name/log Equivalent to [/api/:username/repos/:name/log](#GET-apiusernamereposnamelog), |