mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-02 06:02:19 +00:00
0.1.0 Split repos, Add API docs, new env vars
This commit is contained in:
parent
cf4498e8bc
commit
306bab997b
55 changed files with 19278 additions and 11 deletions
126
docs/api/source/includes/_authentication.md
Normal file
126
docs/api/source/includes/_authentication.md
Normal file
|
@ -0,0 +1,126 @@
|
|||
# Authentication
|
||||
|
||||
## v1/login
|
||||
|
||||
> To obtain a JWT token (Replace default credentials):
|
||||
|
||||
```shell
|
||||
curl "https://goscrobble.com/api/v1/login" \
|
||||
-H "Content-Type: application/json" \
|
||||
--data '{"username":"abc","password":"def"}'
|
||||
```
|
||||
|
||||
> Response:
|
||||
|
||||
```json
|
||||
{
|
||||
"token": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhZG1pbiI6ZmFsc2UsImVtYWlsIjoidGVzdEB0ZXN0LmNvbSIsImV4cCI6MTY0MTAwMjUxOSwiaWF0IjoxNjQwMzk3NzE5LCJtb2QiOnRydWUsInJlZnJlc2hfZXhwIjoxNjQxMDAyNTE5LCJyZWZyZXNoX3Rva2VuIjoiYWJjZGVmZ2hqaWtsbW5vcHF3ZXJ0dXZ3eHl6Iiwic3ViIjoiNDE4ZmRkZmItOGIxYi01MWFiLTliZHMtNGZnMDhjYTYzY2ZmIiwidXNlcm5hbWUiOiJ0ZXN0In0.fuPXjQ7IzNyttgIKpdS4-KBQ-QeHTl-BfgYkSnMCmpVrBunzMrSwr1RzxI7Xg2WWF-FHtW3Bnv9RpSqLDN4F2g"
|
||||
}
|
||||
```
|
||||
|
||||
This endpoint is used to authenticate and retrieve a JWT token.
|
||||
|
||||
### HTTP Request
|
||||
|
||||
`POST https://goscrobble.com/api/v1/login`
|
||||
|
||||
### Query Parameters
|
||||
|
||||
Parameter | Required | Description
|
||||
--------- | ------- | -----------
|
||||
username | true | Account username
|
||||
password | true | Account password
|
||||
|
||||
## v1/register
|
||||
|
||||
> Create a new account (Replace default credentials):
|
||||
|
||||
```shell
|
||||
curl "https://goscrobble.com/api/v1/register" \
|
||||
-H "Content-Type: application/json" \
|
||||
--data '{"email": "test@test.com", "username":"abc","password":"def"}'
|
||||
```
|
||||
|
||||
> Response:
|
||||
|
||||
```json
|
||||
{
|
||||
"message": "User created succesfully. You may now login"
|
||||
}
|
||||
```
|
||||
|
||||
If the server has REGISTRATION_ENABLED=true set, this endpoint will allow you to create a new account. Password must be at least 8 characters long.
|
||||
|
||||
### HTTP Request
|
||||
|
||||
`POST https://goscrobble.com/api/v1/register`
|
||||
|
||||
### Query Parameters
|
||||
|
||||
Parameter | Required | Description
|
||||
--------- | ------- | -----------
|
||||
email | true | Account email
|
||||
username | true | Account username
|
||||
password | true | Account password
|
||||
|
||||
## v1/sendreset
|
||||
|
||||
> Trigger a password reset email:
|
||||
|
||||
```shell
|
||||
curl "https://goscrobble.com/api/v1/sendreset" \
|
||||
-H "Content-Type: application/json" \
|
||||
--data '{"email":"test@test.com"}'
|
||||
```
|
||||
|
||||
> Response:
|
||||
|
||||
```json
|
||||
{
|
||||
"message": "Password reset email sent"
|
||||
}
|
||||
```
|
||||
|
||||
This endpoint triggers a password reset email to be sent to the email on an account.
|
||||
|
||||
### HTTP Request
|
||||
|
||||
`POST https://goscrobble.com/api/v1/sendreset`
|
||||
|
||||
### Query Parameters
|
||||
|
||||
Parameter | Required | Description
|
||||
--------- | ------- | -----------
|
||||
email | true | Account username
|
||||
|
||||
## v1/resetpassword
|
||||
|
||||
> Trigger a password reset email:
|
||||
|
||||
```shell
|
||||
curl "https://goscrobble.com/api/v1/resetpassword" \
|
||||
-H "Content-Type: application/json" \
|
||||
--data '{"token":"abcdefghijklmnopqrstuvwxyz", "password": "Hunter1"}'
|
||||
```
|
||||
|
||||
> Response:
|
||||
|
||||
```json
|
||||
{
|
||||
"message": "Password updated successfully!"
|
||||
}
|
||||
```
|
||||
|
||||
This endpoint confirms a password reset with a valid hash from the reset email. You must call v1/sendreset first and obtain the hash.
|
||||
|
||||
### HTTP Request
|
||||
|
||||
`POST https://goscrobble.com/api/v1/resetpassword`
|
||||
|
||||
### Query Parameters
|
||||
|
||||
Parameter | Required | Description
|
||||
--------- | ------- | -----------
|
||||
token | true | Reset token from the password reset email
|
||||
password | true | New account password
|
||||
|
22
docs/api/source/includes/_errors.md
Normal file
22
docs/api/source/includes/_errors.md
Normal file
|
@ -0,0 +1,22 @@
|
|||
# Errors
|
||||
|
||||
<aside class="notice">
|
||||
This error section is stored in a separate file in <code>includes/_errors.md</code>. Slate allows you to optionally separate out your docs into many files...just save them to the <code>includes</code> folder and add them to the top of your <code>index.md</code>'s frontmatter. Files are included in the order listed.
|
||||
</aside>
|
||||
|
||||
The Kittn API uses the following error codes:
|
||||
|
||||
|
||||
Error Code | Meaning
|
||||
---------- | -------
|
||||
400 | Bad Request -- Your request is invalid.
|
||||
401 | Unauthorized -- Your API key is wrong.
|
||||
403 | Forbidden -- The kitten requested is hidden for administrators only.
|
||||
404 | Not Found -- The specified kitten could not be found.
|
||||
405 | Method Not Allowed -- You tried to access a kitten with an invalid method.
|
||||
406 | Not Acceptable -- You requested a format that isn't json.
|
||||
410 | Gone -- The kitten requested has been removed from our servers.
|
||||
418 | I'm a teapot.
|
||||
429 | Too Many Requests -- You're requesting too many kittens! Slow down!
|
||||
500 | Internal Server Error -- We had a problem with our server. Try again later.
|
||||
503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later.
|
5
docs/api/source/includes/_introduction.md
Normal file
5
docs/api/source/includes/_introduction.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
# Introduction
|
||||
|
||||
Welcome to the GoScrobble API documentation.
|
||||
|
||||
The majority of these API endpoints are public with reasonable rate limits.
|
22
docs/api/source/includes/_serverinfo.md
Normal file
22
docs/api/source/includes/_serverinfo.md
Normal file
|
@ -0,0 +1,22 @@
|
|||
# Server Info
|
||||
## v1/serverinfo
|
||||
> Check server version and registration status:
|
||||
|
||||
```shell
|
||||
curl "https://goscrobble.com/api/v1/serverinfo"
|
||||
```
|
||||
|
||||
> Response:
|
||||
|
||||
```json
|
||||
{
|
||||
"version":"0.1.1",
|
||||
"registration_enabled":"1"
|
||||
}
|
||||
```
|
||||
|
||||
This endpoint is used to get server API version and registration status.
|
||||
|
||||
### HTTP Request
|
||||
|
||||
`GET https://goscrobble.com/api/v1/serverstatus`
|
Loading…
Add table
Add a link
Reference in a new issue