diff options
author | Simon Ser <contact@emersion.fr> | 2021-10-18 09:48:28 +0000 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2021-10-18 14:45:33 +0200 |
commit | a1a7f5c5566a2f14ec373ec1f0f2cb4ddd6bb2c4 (patch) | |
tree | 9d3307fb8e993c597dad6074168bde8eadd007e1 | |
parent | f18e4f1b0c5a674132fe6f15eabe427bdf1f9c86 (diff) | |
download | sr.ht-docs-a1a7f5c5566a2f14ec373ec1f0f2cb4ddd6bb2c4.tar.gz |
pages.sr.ht: add API reference
This documents the API implemented in [1].
[1]: https://git.sr.ht/~sircmpwn/pages.sr.ht/tree/master/item/server.go
-rw-r--r-- | pages.sr.ht/api.md | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/pages.sr.ht/api.md b/pages.sr.ht/api.md new file mode 100644 index 0000000..b7e6d0e --- /dev/null +++ b/pages.sr.ht/api.md @@ -0,0 +1,32 @@ +--- +title: pages.sr.ht API reference +--- + +The pages.sr.ht API is a convenience wrapper around the [GraphQL API][0] and +allows one to easily publish a site with tools like `curl`. + +# API endpoints + +The following endpoints are available to users with an OAuth2 token valid for +the specified scope. + +## POST /publish/:domain + +**Scopes**: `PAGES:RW` + +Publish a site. + +The request body must use the `multipart/form-data` content type. The following +fields are supported: + +- `content` (required): a .tar.gz file containing the new site content. +- `protocol`: select which protocol variant of the site to update. If unset, + defaults to HTTPS. + +A sub-directory can be appended to the URL (e.g. `/publish/example.org/subdir`) +in which case only the specified sub-directory is updated. The rest of the +files are left unchanged. + +The response contains the new site version as plain-text. + +[0]: https://srht.site/graphql |