Button API V3 Docs!
Navigation
Accounting system
Creating an account
Send a POST HTTP request to /api/v3/register/ with json as data
{
"username" : "your_username",
"password" : "your_password",
}
it should return
{'message' : 'User registered successfully!'} , 201
if password doesnt meet the requirements
{'message' : 'Password needs to have 8-20 chars minimum one number minimum one capital letter minimum one special symbol no empty symbols!'}, 411
if username doesnt meet the requirements
{'message' : 'Username needs to be 3-20 chars long!'}, 411
if a user with the username exists
{'message' : 'User exists!'}, 401
Logging into the account (integration to other platforms and crap)
Send a POST HTTP request to /api/v3/login/ with json as data
{
"username" : "your_username",
"password" : "your_password",
}
it should return
{'message' : 'Login successful!'}, 200
if wrong password or username
{'message' : 'Invalid username or password!'}, 401
if password doesnt meet the requirements
{'message' : 'Password needs to have 8-20 chars minimum one number minimum one capital letter minimum one special symbol no empty symbols!'}, 411
if username doesnt meet the requirements
{'message' : 'Username needs to be 3-20 chars long!'}, 411
Token system
Creating a token. And changing the token.
Send a POST HTTP request to /api/v3/generatetoken/ with json as data
{
"username" : "your_username",
"password" : "your_password",
}
it should return
{'message' : 'Made token!',"token" :"8e27530f-309d-44c6-93c9-650b6fddf025"}, 200
if token existed then it should change it
{'message' : 'Changed token!',"token" :"8e27530f-309d-44c6-93c9-650b6fddf025"}, 200
if wrong password or username
{'message' : 'Invalid username or password!'}, 401
if password doesnt meet the requirements
{'message' : 'Password needs to have 8-20 chars minimum one number minimum one capital letter minimum one special symbol no empty symbols!'}, 411
if username doesnt meet the requirements
{'message' : 'Username needs to be 3-20 chars long!'}, 411
Checking your token (geting it).
Send a POST HTTP request to /api/v3/gettoken/ with json as data
{
"username" : "your_username",
"password" : "your_password",
}
it should return
{'message' :'Returning token!',"token" :"8e27530f-309d-44c6-93c9-650b6fddf025"}, 200
if the token doesnt exist it should return
{'message' : 'No token!'},401
if wrong password or username
{'message' : 'Invalid username or password!'}, 401
if password doesnt meet the requirements
{'message' : 'Password needs to have 8-20 chars minimum one number minimum one capital letter minimum one special symbol no empty symbols!'}, 411
if username doesnt meet the requirements
{'message' : 'Username needs to be 3-20 chars long!'}, 411
Messaging system (needs a token)
Sending a message to discord
Send a POST HTTP request to /api/v3/senddcmsgwithtoken/ with json as data
{
"token" : "your_token",
"message" : "your_message",
}
it should return
{'message' :'Sent message!'}, 200
if the token is invalid
{'message' : 'Invalid token!'}, 401
geting messages for everyone (mostly system)
Send a POST HTTP request to /api/v3/getmessagesforeveryone/ with json as data
{
"token" : "your_token",
"count" : "count_of_messages_to_get"
}
it should return
{'message' :'Got messages!',"messages" : [...]}, 200
if the token is invalid
{'message' : 'Invalid token!'}, 401
Get sent messages of a user
Send a POST HTTP request to /api/v3/getmysentmessages/ with json as data
{
"token" : "your_token",
}
it should return
{"sent_messages" : [...]}, 200
if the token is invalid
{'message' : 'Invalid token!'}, 401
if the user has no sent messages
{'message' : 'No sent messages!'}, 404
Reading messages from message id
Send a POST HTTP request to /api/v3/readmessagesfromchannel/ with json as data
{
"token" : "your_token",
"message_id" : "message id",
}
it should return
{"messages" : [...]}, 200
if the token is invalid
{'message' : 'Invalid token!'}, 401
if the user cannot read the message
{'message' : 'Your not allowed to read this message!'}, 403
if the message doesnt exist
{'message' : 'Message not found!''}, 404
Delete a message
Send a POST HTTP request to /api/v3/deletemessage/ with json as data
{
"token" : "your_token",
"message_id" : "message_id_to_delete"
}
it should return
{"message" : "Message deleted!"}, 200
if the token is invalid
{'message' : 'Invalid token!'}, 401
if the message is not found
{'message' : 'Message not found!'}, 404
if message is not the users
{'message' : 'You can only delete your messages!'}, 403
Channel system (needs a token)
Creating a channel
Send a POST HTTP request to /api/v3/makechannel/ with json as data
{
"token" : "your_token",
"name" : "your_channel_name"
}
it should return
{'message' :'Channel created!','channel_name' :'your_channel_name','channel_id' :10124}, 200
if the token is invalid
{'message' : 'Invalid token!'}, 401
Adding a user to a channel
Send a POST HTTP request to /api/v3/addusertochannel/ with json as data
{
"token" : "your_token",
"name" : "your channels name",
"username" : "username of person to add"
}
it should return
{'message' :'User added to channel!','channel_name' :'your channels name','username' :'username of person to add'}, 200
if the token is invalid
{'message' : 'Invalid token!'}, 401
if the channel doesnt exist
{'message' : 'Channel not found!'}, 404
if the user is not in the channel
{'message' : 'You are not in this channel!'}, 401
Reading messages from a channel
Send a POST HTTP request to /api/v3/readmessagesfromchannel/ with json as data
{
"token" : "your_token",
"name" : "channel name",
"count" : "count_of_messages_to_get"
}
it should return
{"messages" : [...]}, 200
if the token is invalid
{'message' : 'Invalid token!'}, 401
if the channel doesnt exist
{'message' : 'Channel not found!'}, 404
if user not in channel
{'message' : 'You are not in this channel!'}, 401
Sending a message to a channel
Send a POST HTTP request to /api/v3/sendmessage/ with json as data
{
"token" : "your_token",
"message" : "your message",
"channel" : "channel name"
}
it should return
{'message' :'Message sent!'}, 200
if the token is invalid
{'message' : 'Invalid token!'}, 401
if the channel doesnt exist
{'message' : 'Channel not found!'}, 404
if user not in channel
{'message' : 'You are not in this channel!'}, 401
Get list of channels a user has
Send a POST HTTP request to /api/v3/getchannels/ with json as data
{
"token" : "your_token"
}
it should return
{"channels" : [...]}, 200
if the token is invalid
{'message' : 'Invalid token!'}, 401
if you are not in any channels it should return
{'message' : 'You are not in any channels!'}, 404
Dm system (needs a token)
Get dms of a user
Send a POST HTTP request to /api/v3/getdms/ with json as data
{
"token" : "your_token",
"count" : "count_of_dms_to_get"
}
it should return
{"dms" : [...]}, 200
if the token is invalid
{'message' : 'Invalid token!'}, 401
if the user has no dms
{'message' : 'No dms!'}, 404
Send a dm
Send a POST HTTP request to /api/v3/senddm/ with json as data
{
"token" : "your_token",
"username" : "user_to_dm",
"message" : "message_to_send"
}
it should return
{"message" : "Dm message sent!"}, 200
if the token is invalid
{'message' : 'Invalid token!'}, 401
if the user is not found
{'message' : 'User not found!'}, 404
Dc bot dm and channel message system! (BETA)
Send a message to a channel
Send a POST HTTP request to /api/v3/senddcmsg/ with json as data
{
"token" : "your_token",
"channel" : "channel_to_send_to",
"message" : "message_to_send"
}
it should return
{"message" : "Dm message sent!"}, 200
if the token is invalid
{'message' : 'Invalid token!'}, 401
if the user is not in the channel
{'message': 'Invalid input or user not in channel'}, 400
WARNING!! IT MAY NOT SUCEED WITH SENDING AND RETURN IT SUCCEDED!
Send a message to a person (needs to be logged by messaging buttonapi bot)
Send a POST HTTP request to /api/v3/senddcmsg/ with json as data
{
"token" : "your_token",
"channel" : "user_to_dm",
"message" : "message_to_send"
}
it should return
{"message" : "Dm message sent!"}, 200
if the token is invalid
{'message' : 'Invalid token!'}, 401
if the user is not in the "dm channel"
{'message': 'Invalid input or user not in channel'}, 400
WARNING!! IT MAY NOT SUCEED WITH SENDING AND RETURN IT SUCCEDED!
Socketio events
Conneting
After connecting to socketio server you will need to pass api_v3_connect event with the following data
{
'token_api_v3' : "your_token"
}
the server should respond by sending back a ready event with the following data
Server has accepted the connection and registered you as : *your username*
Dm event
When a dm is sent, the socketio server will emit an event to the reciver of the dm
new_dm
{
'sender' : "senders username",
'message' : "message",
'recipient' : "the reciver of the dm"
}
Message sent in channel event
When a message is sent in a channel, the socketio server will emit an event to all users who can access that channel
{
'sender' : "senders username",
'message' : "message",
'channel' : "channel name",
'timestamp' : "timestamp"
}