Page 1 of 1

Querystrings in Manialinks (Bad Request)

Posted: 10 May 2011, 19:09
by destroflyer
Hi all,
I don't know if that's a bug or not: If you use a querystring like ...
manialink?page=home
... the API throws an error 'Bad Request'.
Fatal error: Uncaught exception 'TrackMania_Exception' with message 'Bad request' in [...]/trackmania-ws.php:519
Stack trace:
#0 [...]/trackmania-ws.php(355): TrackMania_WebServices->execute('GET', '/tmf/manialinks...', Array)
#1 [...]/trackmania-ws.php(44): TrackMania_WebServices->executeGET('/tmf/manialinks...', Array)
#2 [...]
#3 [...]
#4 [...]
#5 {main}
thrown in [...]/trackmania-ws.php on line 519
Of course, the querystring is not part of a maniacode and you could use it later in your code, but it may be helpful for beginners, if the API would just remove every querystring from the requestes code and just return the data for the simple maniacode. (Instead of throwing an error)

But I can understand other opinions, too ^__^ (Because with a querystring, it's not a "real" maniacode ;))

destro :)

Re: Querystrings in Manialinks (Bad Request)

Posted: 10 May 2011, 22:35
by gouxim
Hey,

I tested the manialink "test?test=test" which should return 404 because it does not exists. So the URL is

http://ws.trackmania.com/tmf/manialinks ... st%3Dtest/ (note the URL encoding)

And it returns 400 indeed, although it should return 404. There's a bug on the server, I'll look into it tomorow.

However, I don't think the API should be automatically stripping the query string in order to keep things simple. It'd be very easy to strip it on your end before calling the API.