Page 2 of 2

Re: SDK v. 0.2

Posted: 09 May 2011, 10:11
by w1lla
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

Re: SDK v. 0.2

Posted: 09 May 2011, 10:21
by gouxim
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.).

Re: SDK v. 0.2

Posted: 09 May 2011, 10:25
by m4rcel
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 ;)

Re: SDK v. 0.2

Posted: 09 May 2011, 10:30
by gouxim
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.