TribesNext

Welcome, Guest. Please login or register.
Did you miss your activation email?


TribesNext >  TribesNext.com Forums >  Support >  TribesNext Profile and Clan API [BETA] « previous next »
Pages: [1] 2 3 ... 5 Print
Author Topic: TribesNext Profile and Clan API [BETA]
Thyth
Apotheosis Incarnate

Posts: 794

View Profile
May 21, 2014, 10:16:49 PM »
I spent a couple of hours shaking out cobwebs and skeletons from the unfinished TribesNext community backend system. This is the system responsible for managing clans, tags, player profiles, and so forth. The implementation was mostly complete 2 years ago, but not fully stable or fully abuse resistant. The remaining blocker issues to general availability have been resolved now.

I won't have time any time in the near future (or ever?) to complete the in-game UIs for T-Mail or player/clan browser -- if you're interested, capable, and would like to take on the task, you're welcome to try.

This is a "beta" release of JSON APIs covering password based authentication (over plaintext HTTP-- oh my!), and all of the APIs required to create and manage clans and user profiles within the TribesNext system. I made use of these APIs by hand when managing the first three or four seasons of the Draft League tournaments (before moving on to assorted level of completeness in-game UIs). The API endpoints support JSONP to permit bypassing cross origin policy restrictions if you would like to build an alternative UI for yourself.

Endpoints are as follow:
http://tribesnext.thyth.com/tn/json/json_session.php -- this is responsible for password authentication methods
http://tribesnext.thyth.com/tn/json/json_browser.php -- this provides browser APIs once an authenticated session is established

Source code to both endpoints in PHP can be viewed:
http://tribesnext.thyth.com/tn/json/json_session.phps
http://tribesnext.thyth.com/tn/json/json_browser.phps
This source code should be sufficient information to get started. I'll write more complete documentation as time allows later.

To have a visible clan tag in game, you will need to download and install the in-game community stub script used for the Draft League tournaments: http://tribesnext.thyth.com/tn/tournamentNetClient2.zip

Be advised that these endpoints may change or become inactive without warning. If people actually start using them, I may move them to a tribesnext.com subdomain. Also, there are certain policy restrictions on the number of times an account will be able to issue certain types of requests in a time period (esp. new clan creation).

All TN accounts should be able to authenticate against this endpoint now that the account and community services have been integrated.

Enjoy.
« Last Edit: September 16, 2017, 01:47:14 PM by Thyth »

Sarcastic, narcissistic, genius, resurrecting the game with brilliant strokes of wizardry.
Thyth
Apotheosis Incarnate

Posts: 794

View Profile
1: May 22, 2014, 08:03:55 PM »
Session API (http://tribesnext.thyth.com/tn/json/json_session.php):
In order to use the browser APIs, you must first establish an authenticated session with the system. For the JSON API, the only currently supported method is with a direct password authentication over plaintext HTTP. The T2 targeted "robot" API is capable of doing an RSA key challenge response with an account key; see the tournamentNetClient.zip for the script implementation of this method if you would like to initialize sessions without transmitting plaintext credentials. If there is demand, I will expose access to these capabilities to the JSON side. Sessions initialized via "robot" API and JSON API are equivalent once established -- you can alternatively extract the session ID variable from a T2 authenticated instance for use as the "uuid" parameter.

The API responds to all HTTP methods (GET/POST/etc.) effectively equivalently. I suggest using POST method and form encoding of the request parameters to avoid accidental transmission of the session identifier in referrer fields.

Accepted request parameters
  • method: "login", "logout"
  • guid: account unique identifier
  • uuid: authenticated session identifier
  • un: account username
  • pw: account password
  • jsonp: callback function name

Parameter Table
method=Required parameters:Successful output:Failed output:
loginun, pw{"status":"success","guid":<guid>,"uuid":<session id>,"message":"logged in"}{"status":"error","message":<user printable error message>}
logoutguid, uuid{"status":"success"}<blank>

Looks like the TribesNext forum style is stripping table borders. Copy/paste to another HTML document for enhanced readability.
« Last Edit: September 16, 2017, 01:47:41 PM by Thyth »

Sarcastic, narcissistic, genius, resurrecting the game with brilliant strokes of wizardry.
Thyth
Apotheosis Incarnate

Posts: 794

View Profile
2: May 22, 2014, 08:44:02 PM »
Browser API (http://tribesnext.thyth.com/tn/json/json_browser.php):
Once you have initiated an authenticated session with the system, you can invoke requests against the browser API.
Accepted request parameters
  • method: <see table below>
  • guid: account unique identifier
  • uuid: authenticated session identifier
  • payload: JSON encoded method parameters
  • jsonp: callback function name
The output of most methods is nearly identical.
On successful invocation, you will get: {"status": "success"}
On failed invocation, you will get: {"status": "error", "msg": <user printable error message>}
The output example is only specified if the method output deviates from these possibilities.
Parameter Table
method=Description:Payload example:Output example:
clansearchSearch for clans by name.{"q":"name"}[{"id": "clanid", "name": "clan name"}]
clanviewView clan details, suitable for showing a clan profile page.{"id":"numeric clan id"}{"id":"clanid", "name": "clan name", "tag": "clan tag", "append": "tag at end of name?",
"recruiting": "clan recruiting?", "website": "clan website", "info": "clan profile page text",
"creation": "UNIX timestamp for clan creation time", "picture": "in-game picture shown in profile",
"active": "whether or not this clan is active or abandoned/disbanded"
"members": [{"guid":"member GUID", "name":"member name", "tag":"member's active tag",
  "append":"member's tag at end of name?", "rank": "member's rank in this clan",
  "title": "member's title in this clan", "online": "player is currently online?"}]}
clanhistoryView clan audit history.{"id":"numeric clan id"}<see notes on history payload>
clanrecruitSet clan recruiting status.{"id":"clan ID","v":"true/false recruitment status"}
claninfoSet the clan browser page info.{"id","clan ID","v","Text for the clan's info page."}
clantagSet the tag on a clan.{"id":"clan ID","tag":"tag string","append":"true/false boolean controlling tag at start/end of name"}
clansiteSet the clan website.{"id":"clan ID","v":"www.example.com"}
clannameRename a clan.{"id":"clan ID","v":"New Clan Name"}
clanpictureSet which picture is used on the clan info page for the in-game GUIs.{"id":"clan ID","v":"path/to/in-game-img.png"}
claninviteSend an invitation to join the clan to another player.{"id":"clan ID","to":"invitee GUID"}
clanviewinvitesView outstanding invites to a clan.{"id":"clan ID"}{"status": "success", "payload":
   [{"sender": {"guid": "sender GUID", "name": "sender name", "tag": "sender tag", "append": "append tag?"},
     "recipient": {"guid": "invitee GUID", "name": "invitee name", "tag": "invitee tag", "append": "append tag?"},
     "expire": "UNIX timestamp for invitation expiration"}]}
clanrankChange rank/title of a player in a clan. Can be on self.{"id":"clan ID","to":"target GUID","rank":"integer 0 to 4","title":"Text Title in Clan"}
clankickKick a player from a clan.{"id":"clan ID","to":"kickee"}
clandisbandAuthorize disband of a clan, or retract that authorization (if the clan is still around).{"id":"clan ID","v":"yes/no disband authorization status"}
usersearchSearch for players by name.{"q":"player name"}[{"guid":"account GUID", "name":"player name", "tag":"player active tag", "append":"tag at end?"}]
userviewView user details, suitable for showing a user profile page.{"id":"account GUID"}{"guid":"account GUID", "name": "player name", "tag": "active tag", "append": "tag at end of name?",
"creation": "UNIX timestamp of account creation", "website": "player's website", "info": "Player profile text..."
"online": "is player online?", "memberships": [{"id":"clanid","name":"clan name","rank":"clan rank",
  "title":"clan title", "tag","tag of clan", "append":"is clan's tag appended?"}]}
userhistoryView user audit history.{"id":"account GUID"}<see notes on history payload>
usernameRequest an account name change. {"name": "New desired account name"}
userclanSet which clan tag is active. Client must be a member of a clan to set the tag. Supplying -1 will set no active tag.{"id", "clanid or -1"}
usersiteSet player profile website link.{"site": "www.example.com"}
userinfoSet player profile page text contents.{"info": "Profile page contents..."}
userinvitesGet a list of invitations for this player.<no payload>[{"sender":{"guid":"inviter GUID", "tag": "inviter tag", "append": "inviter tag append?",
  "name": "inviter name"}, "clan":{"name": "clan name", "id": "clanid", "tag": "clan tag",
  "append": "clan tag appended?"}, "expire":"UNIX timestamp for when invitation expires"}]
useracceptAccept a clan join invitation.{"id": "clanid from the invitation"}
userrejectDecline a clan join invitation.{"id": "clanid from the invitation"}
userleaveLeave a clan.{"id", "clanid to leave"}
createclanCreate a new clan.{"tag": "desired clan tag", "append": "yes/no/true/false", "name": "desired clan name", "recruiting": "yes/no/true/false", "info": "initial clan profile page"}<TODO notes>
« Last Edit: September 16, 2017, 01:47:58 PM by Thyth »

Sarcastic, narcissistic, genius, resurrecting the game with brilliant strokes of wizardry.
Ragora
Seņor Nugget

Posts: 218

View Profile WWW
3: May 23, 2014, 11:10:09 AM »
This doesn't seem to be nearly as difficult as I initially thought when I made this post. At this point the only thing I'm really worried about is proper JSON parsing ingame (the Tourny script at a quick glance seems to be doing it in a rather hacky way), since everything else should be relatively trivial beyond that. But for that I'm pondering using some custom C++ code to provide a regex engine from something like Boost since it's pretty easy to have both TribesNext and 3rd party C++ coding operating at the same time.
« Last Edit: May 23, 2014, 11:42:54 AM by Liukcairo »

"Only two things are infinite, the universe and human stupidity, and I'm not sure about the former." - Supposedly Einstein
F9
Nugget
Posts: 31

View Profile
4: May 23, 2014, 05:34:54 PM »
For the Password or pw would it be the 3 part of the public.store? or would it be the actual player password non encrypted or anything?
Thyth
Apotheosis Incarnate

Posts: 794

View Profile
5: May 23, 2014, 06:53:53 PM »
I'm not sure how "direct password authentication over plaintext HTTP" can be interpreted any differently than "direct password authentication over plaintext HTTP". I also wouldn't have called attention to the complete lack of security if it was something else.

If you're interested in producing an in-game client, you'll likely want to use the "robot" API instead of the JSON API. Parsing JSON will not be a fun exercise in T2 script, and the "robot" API produces a line oriented regular data format more amenable to parsing with the limited string processing capabilities exposed by the game. Get in touch with me directly if you want to go that route.

Sarcastic, narcissistic, genius, resurrecting the game with brilliant strokes of wizardry.
F9
Nugget
Posts: 31

View Profile
6: May 23, 2014, 08:20:44 PM »
i misread certain parts because of tiredness and i had DX help me out a bit... odd thing is trying to get the password into a global var at login so then it can be used to be put into the authentication of the session... i tried more of the logical ways of doing so for some reason i am unable to get the password though

EDIT: nvm i got it took some time and effort and major brain farts to figure out that i needed to delete the dso files in the T2csri.vl2 oh well at least it works now
« Last Edit: May 24, 2014, 06:11:37 AM by F9 »
({STAR})earthinhabitant
Seņor Nugget

Posts: 221

View Profile
7: May 24, 2014, 10:06:37 AM »
thanks Thyth for chiming in on things and everyone else for inspiration.

Some reason I missed notifications for this thread..checked now.


I need to review thread, as it looks encouraging at a glance.

We are planning some new tourneys now for cash, to get the revival started!

 Roll Eyes
teratos
Assault
Posts: 899

View Profile
8: May 24, 2014, 11:10:07 AM »
Thanks for posting this stuff Thyth.

I have working web interface with login/logout. I'll go ahead and add the other features in and then maybe someone else can look about doing it in-game. I doubt I have the time to grind through crappy T2 code.

"Enjoy the rest of your sad elitist life as I will pursue helping gamers in this gamer generation, and perhaps you will develop an unstretchable itch in the knowledge that people like you mean very little to me, or anyone else with strong care in anything that they pursue."
 - sgtvindetta
Thyth
Apotheosis Incarnate

Posts: 794

View Profile
9: May 24, 2014, 01:22:14 PM »
There is a roughly 5000 line of code implementation for in-game UIs that's nearly complete (the ones I showed off http://www.tribesnext.com/forum/index.php?topic=3132.0). I'll put together a git repo so people can look at it and contribute patches for remaining bugs/polish and the couple missing features.

Sarcastic, narcissistic, genius, resurrecting the game with brilliant strokes of wizardry.
({STAR})earthinhabitant
Seņor Nugget

Posts: 221

View Profile
10: May 24, 2014, 06:23:00 PM »
There is a roughly 5000 line of code implementation for in-game UIs that's nearly complete (the ones I showed off http://www.tribesnext.com/forum/index.php?topic=3132.0). I'll put together a git repo so people can look at it and contribute patches for remaining bugs/polish and the couple missing features.

Now we are talking, thanks again!

 Shocked
F9
Nugget
Posts: 31

View Profile
11: May 24, 2014, 06:41:17 PM »
remember that this is more so of the finished product for the entire community to use...
teratos
Assault
Posts: 899

View Profile
12: May 24, 2014, 09:33:20 PM »
http://tribes2stats.com/browser/
I will periodically check here or this thread ( http://www.t2forums.com/index.php?topic=85.0 ) for feedback.

"Enjoy the rest of your sad elitist life as I will pursue helping gamers in this gamer generation, and perhaps you will develop an unstretchable itch in the knowledge that people like you mean very little to me, or anyone else with strong care in anything that they pursue."
 - sgtvindetta
F9
Nugget
Posts: 31

View Profile
13: May 25, 2014, 05:56:38 AM »
Seems when you have switched the tribe name and tag in the creation page, seems you are unable to change your name in the profile
« Last Edit: May 25, 2014, 06:05:34 AM by F9 »
Phantom139
Scout

Posts: 262

View Profile WWW
14: May 25, 2014, 08:19:02 AM »
Alright, So I poked through a bit, Created a testing clan, and then messed around with settings and other stuff.

Aside from the bug mentioned by F9 above, there's just a few formatting errors I'm seeing.

Here's an example:
Code:
Phantom139 set clan website to: "http://www.phantomdev.netquot;.

Here's another one:
Code:
append mode: 0^

Everything else appears to be functioning as it should. I'll keep poking around a bit to see if there's anything that's doing what it shouldn't do.

Bio:
Founder/Creator Phantom Games Development.
Tribes 2 Modder, T3D Owner and Developer
Site:
www.phantomdev.net
Pages: [1] 2 3 ... 5 Print 
« previous next »
Jump to:  

irc.quakenet.org / #TribesNext Powered by SMF 1.1.21 | SMF © 2005, Simple Machines