Skip to content

Configuration

DeinAlbtraumTV edited this page Jun 23, 2022 · 3 revisions

Retrieving and Modifying Configurations

This endpoint allows you to access and modify the configurations of a server the bot is in, as long as the user accessing this endpoint has the rights to do so.

All endpoints require a valid 'Authorization' header with a Bearer-type token to be present in the request, for more information on authentication take a look at this page.

/config/{guildid}

This endpoint allows you to both retrieve and modify a configuration. To retrieve one, just make a GET request to this endpoint (make sure to include your authorization header).

Request:

curl -X GET https://api.ratingtool.xyz/config/969347293281157180 -H "Authorization: Bearer x9CFrvUbRAqb23TxLnDaAXUo6DKjwFAE.2579.376"

Response:

{
    "config": {
        "general": {
            "language": "ENGLISH",
            "adminRoleId": 974756723913011292
        },
        "rating": {
            "ratingLogChannelId": 985461337469620266,
            "ratingCategoryIds": [],
            "ratingRoleIds": [],
            "ratingChannelIds": []
        },
        "premium": {
            "premiumUntil": 27953413995,
            "localizationOverrides": {},
            "buttonStyle": "PRIMARY",
            "footer": {
                "text": "RatingTool.xyz ~ Get feedback and improve.",
                "iconUrl": "https://cdn.discordapp.com/attachments/969972358372819026/975430041993351178/Robo_04gif.gif"
            },
            "color": {
                "defaultColorHex": "#2F3136",
                "infoColorHex": "#4E60A9",
                "warnColorHex": "#EBA434",
                "errorColorHex": "#EB3434"
            }
        }
    }
}

Updating a config is just as easy as retrieving one. Just submit a POST request to this endpoint and set the body of the request to the config object.

Careful! Don't wrap your config in an object called config, as shown in the response above! The config itself must be the body

An example body might look like the following:

{
    "general": {
        "language": "GERMAN",
        "adminRoleId": 974756723913011292
    },
    "rating": {
        "ratingLogChannelId": 985461337469620266,
        "ratingCategoryIds": [],
        "ratingRoleIds": [],
        "ratingChannelIds": []
    },
    "premium": {
        "localizationOverrides": {},
        "buttonStyle": "PRIMARY",
        "footer": {
            "text": "RatingTool.xyz ~ Get feedback and improve.",
            "iconUrl": "https://cdn.discordapp.com/attachments/969972358372819026/975430041993351178/Robo_04gif.gif"
        },
        "color": {
            "defaultColorHex": "#2F3136",
            "infoColorHex": "#4E60A9",
            "warnColorHex": "#EBA434",
            "errorColorHex": "#EB3434"
        }
    }
}

The response to a post request will be a 200 success response with the new config in the body of the response

Clone this wiki locally