|09/04/2009 23:21:05 Novice API connection question|
I'm interested in trying my hand at a bot, but I've kind of stumbled at the first hurdle. I've grabbed a copy of the example bot, not changed a thing, compiled it, ran it with the right arguments (username then apitoken) but get a 401 error (well, an IOException because of it) every time.
What am I doing wrong? I've tried creating a new apitoken, checked the username is correct. When I debug I can see it's calling Eliza.httpRequest with the right URL (http://test.weewar.com/api1/headquarters), right username and right password.
If you fancy trying to replicate it, my bot-to-be's username is ai_RichBot and the current apitoken is RrjyTTuj8QmSEa3QJUHz5Cyu9 . Any help would be appreciated!
java.io.IOException: Server returned HTTP response code: 401 for URL: http://test.weewar.com/api1/headquarters
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.security.AccessController.doPrivileged(Native Method)
|09/04/2009 23:42:54 Re:Novice API connection question|
Ok now this is odd!
Looking at the source for java.net.URLConnection, it turns out every single getHeaderField method does nothing - they just immediately return null or an empty collection. What gives? And why does the example bot bother using it?
|10/04/2009 00:15:20 Re:Novice API connection question|
Try using weewar.com instead of test.weewar.com, unless that was your intention. Not sure if that would fix it, but it might help.
This message was edited 1 time. Last update was at 10/04/2009 00:16:46
|10/04/2009 05:32:36 Re:Novice API connection question|
|Spade's right I just hit the link and used your bot name and token and could not log in, when i removed the 'test.' i was ab;e to log in without any problems|
|10/04/2009 10:10:52 Re:Novice API connection question|
Fantastic guys, thanks!
It's test.weewar.com that's default in the code, but I don't have an account there.
Still, bit weird that sun's java api has unimplemented methods...