Skip to content

API Documentation

tkaixiang edited this page Nov 26, 2021 · 5 revisions

Please check out the sidebar on the right for information on endpoints!

General Notes

The API runs on localhost:20001 in a production deployment

Since version 1.0, manually setting CORS is no longer required since requests are sent to the same origin

MongoDB Validation & Indexes are inserted automatically at the start if they are not detected inside the DB. Please edit validators.js and the indexes at the start if you would like to change anything.

Responses

General Response Structure

Response Definition
{"success": true} The request was successfully completed
{"success": false, "error": "ERROR_CODE"} The request was unsuccessful due to the error stated in error

Error Code Definitions

Error Error Code Definition
unknown 500 The reason for the failure is not documented
missing-token 401 The request did not send an Authorization header, but the endpoint is authenticated
wrong-token 401 The token sent has either expired or been tampered with
permissions 403 The user does not have sufficient permissions to run the operation
validation 400 The input was malformed

All authenticated endpoints require an Authorization header with the token retrieved from the login endpoint.