Using the PB2 API.

Tutorials and guides for Plazma Burst and community features.

Using the PB2 API.

Postby ZapruderFilm » 3 January 2018, 20:47

Hello there! This is going to cover use of the PB2 API.

The PB2 API is a system where you can read Database values from the api by visiting a URL.
The data will be in JSON format and can be parsed to access values.

https://www.plazmaburst2.com/extract.php?login=Duriel
Here is an example of a URL you might pull.

Currently you do not need an API key to pull values.

Let's begin by showing various URL's, how you can format them, and what they do and why.

https://www.plazmaburst2.com/extract.php?login=Duriel

extract.php is the name of the file on the website. Then, after this, you insert a question mark (?) put the query type, (login in the example case), and = sign, then the login you want the data from.

The query type can be several things.

To date, these are the available datas:

?login= To pull data by a user's login name (The thing they type in when they login to their account)

?uid= To pull data from a user's identifier.

For example, http://plazmaburst2.com/?a=&s=7&ac=Zapr ... id=1560883 in this URL, &id=1560883 contains the identifier. So, doing
https://www.plazmaburst2.com/extract.ph ... pruderFilm is equal to doing
https://www.plazmaburst2.com/extract.php?uid=1560883

?top= To pull data from a leaderboard. Will return a json object with a key that is an array of UID's.
The leaderboard ID is defined in the URL of the leaderboard page.

For example, http://plazmaburst2.com/?a=&s=4&pg=0 is the URL of the top 200 players page. So, if we wanted to pull the UID's of the top 200 players, we would simply use this URL:

https://www.plazmaburst2.com/extract.php?top=0

pg=0 is the identifier for the leaderboards. Some leaderboards are disabled for this, and not all will work.


Moving on, let's cover the meaning of the json values from login and UID data, as some are not very straight forward.

"uid" - The Universal Identifier of a user. Used in profile links and leaderboard data.

"s_kills" - The number of kills the player has.

"s_deaths" - The number of deaths a player has.

"vector_kills" - Not completely understood yet.

"vector_deaths" - Not completely understood yet.

"xmpp" - The data in a players "XMPP" profile field.

"icq" - The data in a players "ICQ" profile field.

"skype" - The data in a players "Skype" profile field.

"web" - The data in a players "Website" profile field. When viewed on profile, it will be have the same HTML as a hyperlink.

"slogan" - The data in a players slogan profile field.

"nickname" - A players set nickname.

"login" - The players login name. They type this in the login field, and it is also in their profile link.

"mdl" - The user's deathmatch character. There is extra logic required, and this can be used to have a function returning a link to a players character for an avatar. (Will update later with logic.)

"mdl2" - The user's selected Team Deathmatch character value. Not sure where the character pictures for this are hosted, will update later.

"location" - The data in a player's location field. Player's choose this, and it may not be accurate to their real location.

"gender" - A player's gender, which will return usually male or female with some exceptions.

"clan" - A field for clans that was going to be used when/if a clan system is implemented. This shouldn't ever contain data as far as I am aware.

"birth" - The data in a player's birthdate field.

"register" - The player's register date stored as a unix timestamp. May conflict with real_register. Whichever of these is older, is the closest to the actual register date. Most players will be accurate, but there are some inconsistencies with older players.

"real_register" - The player's register date stored as a unix timestamp. May conflict with register. Whichever of these is older, is the closest to the actual register date. Most players will be accurate, but there are some inconsistencies with older players.

"superuser" - Unknown

"banned" - Will return 0 if the player is not banned, will return 1 if the player is banned.

"points" - Unknown

"rec_from" - Unknown

"rec_bf_from" - Unknown

"max_reached_place" - Not completely sure, but I believe this value is the highest rank you achieved in either the top 1000 or 200 players. When they haven't reached this yet, it just returns 1000.

"reached_when" - Will return 0 if the above value is 1000, and otherwise, a Unix timestamp of when the player reached the place in "max_reached_place"

"dev_rank" - A players Level Developer Rank.

"player_rank" - A players PPP.

"chat_admin" - A value used to tell if a player has admin powers on the PB2 chat. If 1, the player is an admin. Otherwise, they are not.

"chat_moderator" - A value used to tell if a player has a chat moderator rank on the PB2 chat. If 2, the player is a head moderator. If 1, the player is a player moderator.

"chat_owner" - Unknown

"multiplayer_moderator" - Used to tell whether or not a player has in game moderation powers. Trial staff and Supports will not have this, other staff will.

"country_code" - The user's country code. May be more accurate than the location field, as it seems this is calculated server side.


Hopefully planning to soon release some libraries to pull data easily and return values so people don't need to learn all this to do things with it.

Will update soon probably with a node js library with a lot of these values being used. Haven't experimented with the leaderboards much yet.

Additional notes:
Be sure to make requests with https, not http.
ZapruderFilm
  
Left PB2 Staff to join Dark Clan.

ZapruderFilm
Android T-01187 [200]
 
Posts: 238
Joined: 26 August 2016, 21:00
Location: USA

Re: Using the PB2 API.

Postby _rayriflepie » 5 January 2018, 17:02

This is really cool! I was using this to look up people account's and I noticed even though my old account was "deleted", the data can still be accessed.
https://www.plazmaburst2.com/extract.ph ... ayriflepie

You said you didn't know what superuser was. I think it's just the same as head admin, since Eric has superuser marked as 1.
Nice post Zap!

_rayriflepie
Recruit
 
Posts: 10
Joined: 10 February 2017, 21:06


Return to Tutorials

Who is online

Users browsing this forum: No registered users



cron