Getting 500 Internal Server Error from API

I’m playing with the API for the first time and I’m getting a 500 Internal Server Error when I PUT the following URL:

https://www.beeminder.com/api/v1/users/kenoub/goals/marathon.json?username=kenoubi&roadall=[[1452963600%2C+null%2C+0.0]%2C+[1454259600%2C+null%2C+15.0]%2C+[1454864400%2C+null%2C+16.5]%2C+[1455469200%2C+null%2C+18.150000000000002]%2C+[1456074000%2C+null%2C+19.965000000000007]%2C+[1456678800%2C+null%2C+21.961500000000004]%2C+[1457283600%2C+null%2C+24.157650000000007]%2C+[1457888400%2C+null%2C+26.573415000000011]%2C+[1458493200%2C+null%2C+29.23075650000002]%2C+[1459098000%2C+null%2C+32.153832150000021]%2C+[1460390400%2C+null%2C+0.0]]&auth_token=AUTH_TOKEN

(I’m sending the actual auth token obviously, not literally AUTH_TOKEN.) There are a number of aspects of what I’m doing that are weird, and there may be a good reason it should fail. But the 500 error isn’t helping me figure out what in particular is wrong.

2 Likes

Haha, and of course I had to post that before noticing the typo in my username in the URL :smile:
Still, 500 isn’t the right response to that, more of a 404 or 403.

2 Likes

Also, now that I did get it to run, I appear to have broken my goal (I have an error message instead of a graph). Which I don’t mind (I’m playing with fire, I expect to get burned), but it probably indicates some missing validation.

1 Like

The road editor API needs some work, particularly around providing helpful error messages.

Email support and they can fix your road, they’re usually helpful and encouraging towards feedback on what needs improving.

2 Likes

How are you making the PUT request, with curl or with a library? Can you paste the response you’re getting?

I ask because I actually don’t see a 500 in the logs for this request. Thanks for the report!

Edit to be more specific: I see that we sent you back a 500, but Honeybadger didn’t send us a full stack trace so that we can see what actually happened.

Further edit: here’s the server log if anyone’s interested:

Processing by Api::V1::GoalsController#update as JSON Parameters: {"username"=>"kenoubi", "roadall"=>"[[1452963600, null, 0.0], [1454259600, null, 15.0], [1454864400, null, 16.5], [1455469200, null, 18.150000000000002], [1456074000, null, 19.965000000000007], [1456678800, null, 21.961500000000004], [1457283600, null, 24.157650000000007], [1457888400, null, 26.573415000000011], [1458493200, null, 29.23075650000002], [1459098000, null, 32.153832150000021], [1460390400, null, 0.0]]", "auth_token"=>"[FILTERED]", "user_id"=>"kenoub", "id"=>"marathon"} Completed 500 Internal Server Error in 78ms (Views: 0.4ms)

3 Likes

I assume it’s the incorrect “user_id” value that caused it? But I was using urllib2 from Python with a hack to send PUT requests as described at http://stackoverflow.com/a/111988. It does work (well, I broke things in an unrelated way for unrelated reasons :slight_smile:) when I use the correct user in the path.

1 Like