Skip to content
This repository has been archived by the owner on Mar 12, 2023. It is now read-only.

The V0 API

zysim edited this page Oct 22, 2021 · 4 revisions

What is the v0 API?

Our "version zero" API documentation exists as a comprehensive description of the endpoints that will be exposed by the server. It constitutes a Minimum Viable Product, and as such is not suitable for production. This API is not only subject to change, but is almost guaranteed to look completely different when v1 comes around. As such, it will almost certainly be scrapped at that time.

Intended Use

We do not recommend that developers build client apps that query this API. This documentation is made public so that developers and users can get an idea of what kind of services the website will likely provide in the future. This Wiki is intended to be used as specification and reference for our developers, not actual documentation, meaning that not all of the features described herein are even likely implemented yet.

Contributing

Anyone with access to the repo may edit the wiki. However, you must get approval from the project lead (currently @Matt-Hurd / Lost_IC in Discord) before making breaking changes. In general, if you want to see a feature added, the best thing to do is to create an issue or come discuss it with us on our discord server.

Routes

All routes are prefixed with api/v1.

POST /register

  • Registers a user.

Fields:

Name Required Type
Username true string
Email true string
Password true string

On Success:

// HTTP 201
{
    "data": {
        "ID": "<string>",
        "Username": "<string>"
    }
}

On Error:

// HTTP 409
{
    "errors": {
        "constraint": "<string>",
        "message": "<string>"
    }
}

// HTTP 500
<Empty response>

POST /login

  • Logs a user in.

POST /logout

  • Logs a user out.

GET /refresh_token

  • Generates a new JWT.

GET /ping

  • Pings the server. A de facto health check lmao.

On success:

// HTTP 200
{
    "message": "pong"
}

GET /users/:id

  • Gets the data of a user.

On success:

// HTTP 200
{
    "data": {
        "ID": "<uint>",
        "Username": "<string>"
    }
}

On Error:

// HTTP 400
<Empty response>

// HTTP 404/500
{
    "message": "<string>"
}

GET /me

  • Gets the currently logged-in user.

On Success:

// HTTP 200
{
    "data": {
        "ID": "<uint>",
        "Username": "<string>",
        "Email": "<string>"
    }
}

On Error:

// HTTP 500
<Empty response>