Communities

This section describes the endpoints for managing communities.

Community Model

The Community object represents a community in the system.

Community Object
{
    "id": 0,
    "name": "string",
    "description": "string",
    "members": [0],
    "posts": [0],
    "icon": "string",
    "banner": "string",
    "nsfw": false,
    "private": false,
    "creation_date": 0,
    "owner": 0
}

Endpoints

/communities [GET]

Get a list of all communities.

Return Example

200 OK
[
    {
        "id": 1,
        "name": "nergeo",
        "description": "Official community for the Nergeo platform.",
        "members": [1,2,3,4,5],
        "posts": [1,11,12],
        "icon": "https://i.imgur.com/1bX5zhE.png",
        "banner": "https://i.imgur.com/7zPcU5A.jpeg",
        "nsfw": false,
        "private": false,
        "creation_date": 1752888000,
        "owner": 1
    }
]
* /communities [POST]

Create a new community.

Request Example

Body
{
    "name": "My New Community",
    "description": "A community for testing.",
    "icon": "",
    "banner": "",
    "nsfw": false,
    "private": false
}
/communities/{id} [GET]

Get a specific community by its ID.

Return Example

200 OK
{
    "id": 1,
    "name": "nergeo",
    "description": "Official community for the Nergeo platform.",
    "members": [1,2,3,4,5],
    "posts": [1,11,12],
    "icon": "https://i.imgur.com/1bX5zhE.png",
    "banner": "https://i.imgur.com/7zPcU5A.jpeg",
    "nsfw": false,
    "private": false,
    "creation_date": 1752888000,
    "owner": 1
}
* /communities/{id} [DELETE]

Delete a specific community by its ID. You must be the owner of the community.

* /communities/{id}/change-description [PUT]

Edit a community's description. You must be the owner of the community.

Request Example

Body
{
    "description": "An updated description."
}
* /communities/{id} [PUT]

Join a community by its ID.

* /communities/{id}/leave [DELETE]

Leave a community by its ID.

Last updated