DISC0RD API Documentation

NOTICE: I just want to make it clear that while it probably won't, the API could change. I'll do my best to update this page if I do change it, and also provide legacy APIs when I do change it.

URL Scheme

All API URLs begin with /api. It's pretty simple. There is one special route: /video (redirects to a random video). It is the only exception.

Responses

Responses are always encoded as JSON and return the type application/json. Except for the exceptions listed above, all endpoints will return a field named status. It will be either success or error. In the case of error, an extra field named error will be provided containing an error message.

Video Endpoints

All videos are served from https://static.termer.net. Videos used to be served from discord.xyz but have been moved over to another system hosted on that domain. All the old https://disc0rd.xyz/video/<FILENAME> links still work, they just redirect to https://static.termer.net URLs now.

Keep in mind that the "thumbnail" field in video objects may be null, although this is unlikely.

GET /api/videos

Returns an array of videos.

Parameters:
offset (optional): Integer at least 0, the offset of results. Defaults to 0.
limit (optional): Integer between 0 and 100, the amount of results to return. Defaults to 100.

Example response:

{
    "status": "success",
    "videos": [
        {
            "id": "tqt7qxdy5v",
            "name": "Luigi, don't be a dinophobe",
            "filename": "luigi_dont_be_a_dinophobe.mp4",
            "created_on": "2020-07-27T17:39:05.949127Z",
            "size": 920566,
            "hash": "gNE+MHXaDVs630sym1VJoOZBb4cThwECwH7z4tv3TeQ=",
            "url": "${config.twineMediaRoot}/download/tqt7qxdy5v/luigi_dont_be_a_dinophobe.mp4",
            "thumbnail": "${config.twineMediaRoot}/thumbnail/tqt7qxdy5v"
        }
    ]
}

GET /api/videos/search

Returns an array of videos based on the specified search term.

Parameters:
offset (optional): Integer at least 0, the offset of results. Defaults to 0.
limit (optional): Integer between 0 and 100, the amount of results to return. Defaults to 100.
order (optional): Integer between 0 and 5, the order to return results. Defaults to 0. (0 = Creation date, newest to oldest, 1 = Creation date, oldest to newest, 2 = Name alphabetically, ascending, 3 = Name alphabetically descending, 4 = Size, largest to smallest, 5 = Size, smallest to largest)
query (optional): String, the search query. Can be empty to return everything. Defaults to empty.

Example response:

{
    "status": "success",
    "videos": [
        {
            "id": "tqt7qxdy5v",
            "name": "Luigi, don't be a dinophobe",
            "filename": "luigi_dont_be_a_dinophobe.mp4",
            "created_on": "2020-07-27T17:39:05.949127Z",
            "size": 920566,
            "hash": "gNE+MHXaDVs630sym1VJoOZBb4cThwECwH7z4tv3TeQ=",
            "url": "${config.twineMediaRoot}/download/tqt7qxdy5v/luigi_dont_be_a_dinophobe.mp4",
            "thumbnail": "${config.twineMediaRoot}/thumbnail/tqt7qxdy5v"
        }
    ]
}

GET /api/videos/random

Returns a random video.

Example response:

{
    "status": "success",
    "id": "tqt7qxdy5v",
    "name": "Luigi, don't be a dinophobe",
    "filename": "luigi_dont_be_a_dinophobe.mp4",
    "created_on": "2020-07-27T17:39:05.949127Z",
    "size": 920566,
    "hash": "gNE+MHXaDVs630sym1VJoOZBb4cThwECwH7z4tv3TeQ=",
    "url": "${config.twineMediaRoot}/download/tqt7qxdy5v/luigi_dont_be_a_dinophobe.mp4",
    "thumbnail": "${config.twineMediaRoot}/thumbnail/tqt7qxdy5v"
}

Misc Endpoints

GET /api/status

Returns a successful response. Useful if you want to check if the API is functioning without trying to fetch any videos.
This will always return a successful response. Anything else means the API is fucked.

Example response:

{
    "status": "success"
}