Getting info about a player's account though an api made by me

Stuff you would like to see in the world of Eliatopia.
Post Reply
User avatar
Kami
Posts:154
Joined:Fri Aug 09, 2019 8:36 pm
Location:somewhere near tiki statues.
Getting info about a player's account though an api made by me

Post by Kami » Wed Mar 10, 2021 12:19 pm

Hi guys, yesterday we (me) made it. now we're able to get data from eliatopia's database (basic player info), as i won't bring any drama about the codes or anything else i made an api key

Here's the api.
[ https://eliatopiaapi.al3x3y.repl.co/getPlayer/ ]

put the player's name after the last /

it will return the data like this:

Code: Select all

{
  "Kami": {
    "EquipedItems": {
      "Armor": "romance armor_h1", 
      "Boots": "jungle shoes_h2", 
      "Helmet": "romance helmet", 
      "Pants": "romance legs", 
      "Weapon": "jungle bow"
    }, 
    "Main": {
      "Area": "32", 
      "Guild": "Kamikaze Penguins", 
      "Level": "46", 
      "TotalHP": "50", 
      "TotalMP": "50", 
      "XP": "36667"
    }, 
    "Stats": {
      "Archery": "50", 
      "Artillery": "0", 
      "Defense": "40", 
      "Expertise": "38", 
      "HP": "50", 
      "MP": "39", 
      "Magic": "0", 
      "Points": "0", 
      "Strenght": "0"
    }
  }
}
Image

and you can get it from there like this (python):

Code: Select all

import requests

player = "Kami"

def getPlayer(player):
    try:
    	playerData = requests.get("https://eliatopiaapi.al3x3y.repl.co/getPlayer/{}".format(player)).json()
    	print(playerData) #make sure that there is something. if you get an error it means that the player is not registered.
    	player_Data = playerData[player]
    	playerArea = player_Data["Main"]["Area"]
    	playerGuild = player_Data["Main"]["Guild"]
    	playerLevel = player_Data["Main"]["Level"]
    	print(f"\nName: {player}\nLevel: {playerLevel}\nGuild: {playerGuild}\nArea: {playerArea}")
    except Exception as err:
    	print("this player is not registered.")

getPlayer(player)
Image

i will add this in eliatopia.py (library made for eliatopia on that im currently working)

for any questions/issues pm me on discord: Kami#0402 or here.
Last edited by Kami on Wed Mar 10, 2021 12:24 pm, edited 1 time in total.

Xharvix
Posts:13
Joined:Fri Feb 19, 2021 11:03 pm

Re: Getting info about a player's account though an api made by me

Post by Xharvix » Wed Mar 10, 2021 12:22 pm

I... don't understand that at all, but ok

*TGFD*
Posts:173
Joined:Mon Jan 04, 2021 6:10 pm

Re: Getting info about a player's account though an api made by me

Post by *TGFD* » Wed Mar 10, 2021 12:39 pm

i try it and it works nice

Post Reply