Open sdunham opened 11 years ago
When I try to post the request, I get a '400 Bad Request' error. I'm 95% sure that my code should work :D
Try now.
Still happening. I'm able to post phone scores though, which have roughly the same format, so I'm not sure why that works and this doesn't...
Sorry about that... Seemed to be working when I tested it in the browser, but it looks like it needs some tweaking. I'll fiddle with it tonight and get back to you.
On Tue, Dec 4, 2012 at 6:17 PM, Daniel Bahr notifications@github.comwrote:
Still happening. I'm able to post phone scores though, which have roughly the same format, so I'm not sure why that works and this doesn't...
— Reply to this email directly or view it on GitHubhttps://github.com/UPS-CS240-F12/main_trunk/issues/6#issuecomment-11025482.
I just successfully retested by sending an ajax call to http://puppetmaster.pugetsound.edu:1730/gameState.json?restartGame=true
Is "Bad Request" the exact error text you're getting back? There are a couple places in the code where we catch errors and respond with a 400 code, and knowing the exact message will help me figure out which one your request is getting caught in.
It's a long shot, but are you sending more than just the restartGame variable with your POST request? If you were sending some phone score data as well, I can see where the issue might be.
On Tue, Dec 4, 2012 at 6:36 PM, Scott Dunham dunham.scott@gmail.com wrote:
Sorry about that... Seemed to be working when I tested it in the browser, but it looks like it needs some tweaking. I'll fiddle with it tonight and get back to you.
On Tue, Dec 4, 2012 at 6:17 PM, Daniel Bahr notifications@github.comwrote:
Still happening. I'm able to post phone scores though, which have roughly the same format, so I'm not sure why that works and this doesn't...
— Reply to this email directly or view it on GitHubhttps://github.com/UPS-CS240-F12/main_trunk/issues/6#issuecomment-11025482.
It should be parsing the request and responding with a 204 "No Content" reply--the 2XX code affirms success but there's no data with which we can logically reply.
Maybe it's working but your code is seeing no content and responding with an error?
On Tue, Dec 4, 2012 at 8:45 PM, sdunham notifications@github.com wrote:
I just successfully retested by sending an ajax call to http://puppetmaster.pugetsound.edu:1730/gameState.json?restartGame=true
Is "Bad Request" the exact error text you're getting back? There are a couple places in the code where we catch errors and respond with a 400 code, and knowing the exact message will help me figure out which one your request is getting caught in.
It's a long shot, but are you sending more than just the restartGame variable with your POST request? If you were sending some phone score data as well, I can see where the issue might be.
On Tue, Dec 4, 2012 at 6:36 PM, Scott Dunham dunham.scott@gmail.com wrote:
Sorry about that... Seemed to be working when I tested it in the browser, but it looks like it needs some tweaking. I'll fiddle with it tonight and get back to you.
On Tue, Dec 4, 2012 at 6:17 PM, Daniel Bahr notifications@github.comwrote:
Still happening. I'm able to post phone scores though, which have roughly the same format, so I'm not sure why that works and this doesn't...
— Reply to this email directly or view it on GitHub< https://github.com/UPS-CS240-F12/main_trunk/issues/6#issuecomment-11025482>.
— Reply to this email directly or view it on GitHubhttps://github.com/UPS-CS240-F12/main_trunk/issues/6#issuecomment-11029495.
I just double-checked my code and I'm not sure there's anything wrong. I will try a couple things tomorrow when I'm on campus again.
In anticipation of getting this issue figured out, I want to make one small tweak to this part of the API which I think should clear up a few unresolved issues.
There are now essentially 2 versions of this call that you can make, and I'm wondering if you can make them in 2 different places in your code:
Let us know if you have any issues with any of this.
On Tue, Dec 4, 2012 at 10:47 PM, Daniel Bahr notifications@github.comwrote:
I just double-checked my code and I'm not sure there's anything wrong. I will try a couple things tomorrow when I'm on campus again.
— Reply to this email directly or view it on GitHubhttps://github.com/UPS-CS240-F12/main_trunk/issues/6#issuecomment-11031399.
I'm still unable to get either of them working. And now that I'm thinking about it, I'm not even sure that updating phone scores is working, because we haven't been able to test with the phone group.
I've spent several hours on this and I still have no idea why it's not working =\
Well, that's frustrating... Sorry for all the issues. Could you point me to where in your code you're making the restartGame calls? You could try POSTing phone scores to the simulator, if you want to test out that functionality before your next meeting with the phone group. I'd be very curious to hear if that fails as well.
This is probably self-explanatory, but just to make sure we've covered all possible sources of this issue:
These calls are different from the standard GET/POST JSON calls, in that they expect URL parameters which we parse on the server side (and don't include any JSON data). The fact that you can successfully POST gameState JSON, but are unable to POST using URL parameters makes me wonder if the required parameters aren't being tacked on to the request URL somehow...
Got it working. I pushed the changes in the most recent commit to the Game Engine's repo.
I'll update the API documentation soon, but you can reset the gameState by POSTing in the following manner:
http://puppetmaster.pugetsound.edu:1730/gameState.json?restartGame=true
If you're not the Game Engine, you probably shouldn't be doing this...