SDK v0.2

Trackmania Forever public API and its open source PHP SDK.

Moderator: NADEO

User avatar
w1lla
Posts: 2377
Joined: 15 Jun 2010, 11:09
Location: Netherlands
Contact:

Re: SDK v. 0.2

Post by w1lla » 09 May 2011, 10:11

Another good documentation about REST and PHP can be found here:

http://www.gen-x-design.com/archives/cr ... -with-php/

And making RESTful requests can be found here:

http://www.gen-x-design.com/archives/ma ... ts-in-php/

Few things that are unnoticed by others.
Function

Code: Select all

getMultiplayerRankingForEnvironment
has two variables called

Code: Select all

$login and $environment
.

The problem with this is that if i use Function

Code: Select all

getMultiplayerRanking
that i can see the Merge but in
Function

Code: Select all

getMultiplayerRankingForEnvironment
is can let the second variabel empty and it will show Merge.

Also environments should be named with Capital letter as stadium or coast doesn't work but Stadium or Coast does.

Function

Code: Select all

Getsoloranking
should have an option for different environments in solo ranking. Due to the fact that if you drive nations you will get an exception message as a fatal error.
Below is the error message

Code: Select all

Fatal error: Uncaught exception 'TrackMania_Exception' with message 'No solo rank, player has a free account' in \TrackMania Web Services\src\trackmania-ws.php on line 512
TM² Info
SM Info
QM Info

OS: Windows 10 x64 Professional
MB: MSI 970A-G46
Processor: AMD FX-6300 3500 mHz
RAM Memory: 16 GB DDR3
Video: SAPPHIRE DUAL-X R9 280X 3GB GDDR5
KB: Logitech G510s
Mouse: Logitech G300s
Mode Creation
ManiaScript Docs

User avatar
gouxim
Nadeo
Nadeo
Posts: 1188
Joined: 14 Jun 2010, 17:20

Re: SDK v. 0.2

Post by gouxim » 09 May 2011, 10:21

I second what farfa said about the architecture. We could imagine in a futur allowing to post a list of ressources to retrieve, but it's won't be done right now anyway.

As I already said, caching is the way to go here. Most objects on our side are cached for like 1 hour, so you can safely cache your API results (except the isOnline stuff) for a couple of hours (or even 24h for stuff like nickname, zone, rankings, etc.).
Please do not PM for support. Instead, create a thread so that everyone can contribute or benefit from the answer! 8-)

User avatar
m4rcel
Posts: 653
Joined: 15 Jun 2010, 11:12
Contact:

Re: SDK v. 0.2

Post by m4rcel » 09 May 2011, 10:25

w1lla wrote:Also environments should be named with Capital letter as stadium or coast doesn't work but Stadium or Coast does.
For this, PHP has a nice function called ucfirst() (UpperCaseFirst), which exactly transforms e.g. "coast" and "COAST" both to the needed "Coast". Maybe the SDK should use the function to correct the string before sending it to the request ;)
ImageImage
Image

User avatar
gouxim
Nadeo
Nadeo
Posts: 1188
Joined: 14 Jun 2010, 17:20

Re: SDK v. 0.2

Post by gouxim » 09 May 2011, 10:30

w1lla wrote: in Function

Code: Select all

getMultiplayerRankingForEnvironment
is can let the second variabel empty and it will show Merge.
Yep, it's because of the ressources :

"ws.trackmania.com/tmf/players/gou1/rankings/multiplayer/Stadium/" will show my mutli ranking for Stadium. If you leave the func param empty it will replace Stadium with empty hence "ws.trackmania.com/tmf/players/gou1/rankings/multiplayer//", and the ressource "ws.trackmania.com/tmf/players/gou1/rankings/multiplayer/" exists.
w1lla wrote:Also environments should be named with Capital letter as stadium or coast doesn't work but Stadium or Coast does.
Indeed, I'll add that in the documentation when we do it.
w1lla wrote:Function

Code: Select all

Getsoloranking
should have an option for different environments in solo ranking.
We'll see if it's possible later (I'm not sure because of the way the DB works).
w1lla wrote:Due to the fact that if you drive nations you will get an exception message as a fatal error.
Below is the error message

Code: Select all

Fatal error: Uncaught exception 'TrackMania_Exception' with message 'No solo rank, player has a free account' in \TrackMania Web Services\src\trackmania-ws.php on line 512
This was done on purpose. Maybe we'll change so that it just returns null instead.
Please do not PM for support. Instead, create a thread so that everyone can contribute or benefit from the answer! 8-)

Post Reply

Return to “Trackmania Forever Web Services”

Who is online

Users browsing this forum: No registered users and 2 guests