Document registration API that I'm about to implement
This commit is contained in:
parent
37f1665f16
commit
17f1583808
1 changed files with 52 additions and 1 deletions
53
API.md
53
API.md
|
@ -89,7 +89,58 @@ curl \
|
|||
|
||||
## Register an Account
|
||||
|
||||
There's currently no API endpoint for creating a new account.
|
||||
This section isn't implemented yet. I'm about to implement it. Putting the API
|
||||
here for review while I'm coding.
|
||||
|
||||
### Check if registration is enabled
|
||||
|
||||
Send a GET request to the `/register/enabled` endpoint. A 2xx response
|
||||
indicates it's enabled, otherwise it's disabled.
|
||||
|
||||
### Check username availability
|
||||
|
||||
Send a GET request to the `/register/available` endpoint:
|
||||
|
||||
```sh
|
||||
curl -X GET \
|
||||
-H 'Authorization: Bearer our_application_access_token_here' \
|
||||
-F 'username=alice' \
|
||||
https://vervis.example/register/available
|
||||
```
|
||||
|
||||
A 2xx response indicates the username is available.
|
||||
|
||||
### Create a new account
|
||||
|
||||
Send a POST request to the `/register` endpoint:
|
||||
|
||||
```sh
|
||||
curl -X POST \
|
||||
-H 'Authorization: Bearer our_application_access_token_here' \
|
||||
-F 'username=alice' \
|
||||
-F 'passphrase=R6GQJ9HqLtRQ58' \
|
||||
-F 'email=alice@email.example' \
|
||||
https://vervis.example/register
|
||||
```
|
||||
|
||||
A 2xx response indicates the account has been created. A JSON object is
|
||||
returned, with a boolean `email_sent` field. If true, a verification email has
|
||||
been sent to the specified email address. If false, it means email verification
|
||||
is disabled on this server, and the account is ready to be used.
|
||||
|
||||
### Verify account
|
||||
|
||||
The email contains a token, which you can end via a POST request to the
|
||||
`/register/verify` endpoint, in order to verify and enable the account:
|
||||
|
||||
```sh
|
||||
curl -X POST \
|
||||
-H 'Authorization: Bearer our_application_access_token_here' \
|
||||
-F 'token=pRiW8ayeuN7UBW4qAKg9qRBE0DUVCIof' \
|
||||
https://vervis.example/register/verify
|
||||
```
|
||||
|
||||
A 2xx response indicates successful verification.
|
||||
|
||||
## Log in as Existing User
|
||||
|
||||
|
|
Loading…
Reference in a new issue