Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
140 lines (102 sloc) 5.04 KB
name
Bancho API (v1)

Bancho API v1

Index

Public
Internal

Public API

GET /api/v1/isOnline

Checks if someone is online on Bancho

GET Parameters

Field name Description Required?
u Username of the user you want to check Only if id is not given
id User ID of the user you want to check Only if u is not given

Response

Field name Description
status Response status code. 200 if no errors
message Message describing the status code
result true if the given user is online, otherwise false

Examples

$ curl http://c.ripple.moe/api/v1/isOnline\?id\=999
{"result": true, "status": 200, "message": "ok"}

$ curl http://c.ripple.moe/api/v1/isOnline\?u\=Nyo
{"result": false, "status": 200, "message": "ok"}

GET /api/v1/onlineUsers

Return how many users are online

Response

Field name Description
status Response status code. 200 if no errors
message Message describing the status code
result Number of online users, including bots

Examples

$ curl http://c.ripple.moe/api/v1/onlineUsers
{"result": 107, "status": 200, "message": "ok"}

Internal API

GET /api/v1/ciTrigger

Trigger the bancho ci-system. Basically, perform a safe bancho shutdown by sending everyone a server restart packet. Afterwards, the ci-system pulls the new commits from git and starts bancho again (not done by bancho). All users are automatically connected as soon as the server goes back online, because they receive a bancho restart packet before disconnecting.

GET Parameters

Field name Description Required?
k Secret Bancho key, specified in config file Yes

Response

Field name Description
status Response status code. 200 if no errors
message Message describing the status code

GET /api/v1/fokabotMessage

Send a message from FokaBot to a channel (even read only or private ones) or to a user.

GET Parameters

Field name Description Required?
k Secret Bancho key, specified in config file Yes
to Recipient channel (must start with #) or username. If the recipient is a user and he's not online, the message won't be sent Yes
msg Text of the message Yes

Response

Field name Description
status Response status code. 200 if no errors
message Message describing the status code

Examples

# Send "Hello" to #announce (%23 = #)
$ curl http://c.ripple.moe/api/v1/fokabotMessage\?k\=supersecretkey\&to\=\%23announce\&msg\=Hello
{"status": 200, "message": "ok"}

# Send "Hello" to Nyo (PM)
$ curl http://c.ripple.moe/api/v1/fokabotMessage\?k\=supersecretkey\&to\=Nyo\&msg\=Hello
{"status": 200, "message": "ok"}

# Wrong key
$ curl http://c.ripple.moe/api/v1/fokabotMessage\?k\=wrongkey\&to\=\%23announce\&msg\=Hello
{"status": 400, "message": "invalid ci key"}

GET /api/v1/verifiedStatus

Check if a user has verified his account through Bancho. Note that the verified statuses are cached in memory and they're reset when Bancho starts, so if you try to check the verified status for an already activated user, the API may tell you that the account has not been verified yet. This API endpoint is meant to be used to check if recently created accounts are pending activation or if they've been activated.

GET Parameters

Field name Description Required?
u User ID of the user you want to check Yes

Response

Field name Description
status Response status code. 200 if no errors
message Message describing the status code
result -1 if the account has not been verified yet.
0 if it has been flagged as multiaccount
1 if it has been verified successfully