-
Notifications
You must be signed in to change notification settings - Fork 0
API Documentation
- The v2 (latest) API frontend is located at https://api.blockcoin.repl.co.
- The API is offline if the Blockcoin server is offline, both are running from the same server.
- "Getting a Blockcoin account" is done by creating an account via our BlockCoin app.
All below instances must proceed the API frontend. If parameters are missing, responseCode of 404 is returned. If parameters are invalid or the server had an error, responseCode of 500 will be returned.
Inputs:
-
user: the username of the user to get the balance of.
Result:
{
"balance": float,
"url":sring,
"username": string
}-
balance: the balance of the user. -
url: the URL of the json -
username: the username of the balance that was requested
Inputs: none
Result:
{
"status": "ok",
}-
status: Always "ok", if there is no response in five seconds (the recommended timeout) then the server is offline.
Inputs:
-
user: the username of the user to get the friend list of. -
password: The BlockCoin password of theuser.
Result:
{
"friends": list,
"username": string
}-
friends: A list where each element is a username of the friends of theusername. -
username: The username of the user that belongs to the friend list.
NOTE: This still works, though it is not the preferred way to perform a transaction.
Inputs:
-
password: The BlockCoin password of the userfrom. -
from: The username of the user from whom the transaction is occurring. -
to: The user to whom the BlockCoins are being given. -
amount: The amount of BlockCoins to give userto.
Result:
{
"amount": float,
"fromUser": string,
"success": bool,
"toUser": string
}-
amount: The amount of BlockCoins given to usertoUserand deducted fromfromUser -
fromUser: The username of the user that performed the transaction. -
success:trueIf the transaction completed,falseotherwise. Ifsuccessisfalse, - an additional parameterreasonwill contain a string of the error message. -
toUser: The user that receivedamountof BlockCoins.
NOTE: For security, this is an indirect transaction. When the api is called, the only thing that occurs is a random code with information is generated. The info is stored in the server, and when one uses the retrieve call, with a code, only then does the transaction occur. This way you can create a QR code for the transaction_code and have a program scan it to run the transaction.
Inputs:
-
password: The BlockCoin password of the userfrom. -
from: The username of the user from whom the transaction is occurring. -
to: The user to whom the BlockCoins are being given. -
amount: The amount of BlockCoins to give userto.
Result:
{
"amount": float,
"fromUser": string,
"success": bool,
"toUser": string,
"transaction_code": int
}-
amount: The amount of BlockCoins given to usertoUserand deducted fromfromUser -
fromUser: The username of the user that performed the transaction. -
success:trueIf the transaction completed,falseotherwise. Ifsuccessisfalse, - an additional parameterreasonwill contain a string of the error message. -
toUser: The user that receivedamountof BlockCoins. -
transaction_code: The identification of the transaction.
Inputs:
-
password: The BlockCoin password of the useruser. -
user: The username of the user who is receiving the BlockCoin. -
code: The transaction code.
Successful Result:
{
"amount": float,
"fromUser": string,
"success": bool,
"toUser": string
}-
amount: The amount of BlockCoins given to usertoUserand deducted fromfromUser -
fromUser: The username of the user that performed the transaction. -
success:trueif the transaction completed,falseotherwise. Iffalse, see the error response for info. -
toUser: The user that receivedamountof BlockCoins.
Invalid Result:
{
"success": bool,
"reason": string
}-
success:trueif the transaction completed,falseotherwise. Iftrue, see the successful response for info. -
reason: The reason for the failed transaction.
NOTE: This is generally used if you wish to create a third-party BlockCoin app or resource.
Inputs:
-
password: The password of theuser. -
user: The user attempting to login.
Result:
{
"success": bool,
"message": string,
"code": int,
"user": string
}-
success:trueif the password/combination is correct orfalseotherwise. -
message: A brief message stating the reason for thecode. -
success: The success code:0for correct password/username combination;1if the user's password is null;2User has not set up a password; or3if the password is incorrect. -
user: The username of the user that attempted login.
NOTE: This is in BETA, as some parameters are never updated.
Inputs:
-
user: The BlockCoin user to return profile details for.
Result:
{
"aboutme": string,
"badges": array,
"balance": float,
"bannerColor": string,
"exists": bool,
"followers": array,
"joinedOn": string,
"pfp": string,
"username": string
}-
aboutme: The text field for the user. -
badges: A list of strings, each string will be an ID of the badge. -
balance: The amount of BlockCoins the user has. -
bannerColor: A string ("blue", "red", "orange", etc.) of the banner color that the user chose. -
exists:trueif this user is a registered account,falseotherwise. -
followers: A list of strings where each string is a username of the user's friends. -
joinedOn: A human-readable date of the account creation. -
pfp: The full URL of the profile pic. -
username: The username of the user.
/update-profile/{user}/{password}/{aboutme}/{bannerColor}/{pfpimg} - Change the profile info of the user (BETA)
NOTE: This call has replaced the update-aboutme call.
IMPORTANT: The pfpimg must be a URL excluding the http:// or https:// preceding it (you may split text at "//"); AND you must replace all instances of "/" in the string with a hash (#). Example: from https://myurl/image/1234 to myurl#image#1234. If this is not done, error 404 will be returned or you may mess up the user's account.
Inputs:
-
user: the username of the user. -
password: The BlockCoin password of theuser. -
aboutme: The new aboutme for the user. -
bannerColor: The new banner color for the user. This can be text up to 8 characters. -
pfpimg: The new URL to the PFP image, formatted as mentioned above.
Result:
{
"success": bool,
"reason": int
}-
success:trueif the update was successful, otherwisefalse. -
reason: The reason forsuccess.1for user not found,2for incorrect password,3for aboutme containing profanity,4for aboutme length too long (max 250 characters, and be sure it contains no ":", "/", or "".),5for banner color name too long,6for pfp image URL too long, and0for success.
Contact:
For help or third-party resource requests, DM busybird15 or S4IL on Discord.
Official BlockCoin Discord server: https://discord.gg/xHFW9dejD5
Official website: https://blockcoinweb.weebly.com