diff options
Diffstat (limited to 'git.sr.ht/api.md')
-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), |