API Routes - TheBeetles/PolliNation GitHub Wiki

Account

Register Account

Creates a new account with the username and password and is sent through json.
Route: /api/register
Method Request: POST

{
   "username": "[username]",
   "password": "[password]"
}

Login

Creates a session cookie and saves it on the users browser.
Route: /api/login
Method Request: POST

{
   "username": "[username]",
   "password": "[password]"
}

Verify

Verifies the user session cookies.
Route: /api/verify
Method Request: GET
Doesn't require any json data

Logout

Removes the session cookie from the users broswer.
Route: /api/logout
Method Request: GET
Doesn't require any json data

Change Password

Changes the password of the user and logs out the user. This requires a fresh login.
Route: /api/change-password
Method Request: POST

{
   "username": "[username]",
   "password": "[password]"
}

Process

Upload Images

Gets and saves the Image the user sent. The user must be logged in.
Route: /api/image/upload
Method Request: POST
Doesn't require any json.

Get a Image

Gets the image ID and responds with the image.
Route: /api/image/get/<image_id>
Method Request: GET
Doesn't require any json.

Get all images

Sends all the ids of the images taken and saved.
Route: /api/image/get/all
Method Request: GET
Doesn't require Json.

⚠️ **GitHub.com Fallback** ⚠️