forgot password?


   
 
500 Error in Rest API
Posted: 20 November 2010 04:53 PM   [ Ignore ]  
Newbie
Rank
Total Posts:  3
Joined  2010-11-20

I’m trying to use the REST API that’s mentioned in the Tracks documentation. When I try one of the curl examples, I get a 500 error. I’m not sure where I should be looking in the logs to find the actual problem.

Request:

curl -u test-user:XXX -"Content-Type: text/xml" -"<project>New Project</project>" http://tracks.coxian.org/projects.xml -i 

Response:

HTTP/1.1 500 Internal Server Error
Date
Sat20 Nov 2010 16:39:52 GMT
Server
Mongrel 1.1.5
Status
500 Internal Server Error
Content
-Typetext/htmlcharset=utf-8
Content
-Length318
Cache
-Controlno-cache
Set
-Cookie_tracks_session_id=c6edf7e7d6c2a45cc563a8f555f69dcepath=/
Via1.1 tracks.coxian.org
Vary
Accept-Encoding
Connection
close

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd"
>
<
html>
<
body>
  <
h1>Application error (Apache)</h1>
  <
p>Change this error message for exceptions thrown outside of an action (like in Dispatcher setups or broken Ruby codein public/500.html</p>
</
body>
</
html

Any help would be greatly appreciated!

Profile
 
 
Posted: 20 November 2010 06:13 PM   [ Ignore ]   [ # 1 ]  
Sr. Member
RankRankRankRank
Total Posts:  882
Joined  2006-10-05

could you look in the tracks log in /path/to/tracks/log/production.log for the error?

Profile
 
 
Posted: 21 November 2010 09:02 PM   [ Ignore ]   [ # 2 ]  
Newbie
Rank
Total Posts:  3
Joined  2010-11-20

Good shout, I couldn’t find the log file before (because I’m a noob). I’ve had a look at the logfile and I’m getting a “undefined method `stringify_keys!’ for “New Project”:String”

Fulls stack below - any ideas?

Processing ProjectsController#create to xml (for 91.121.146.111 at 2010-11-21 21:49:42) [POST]
  
Session ID8b8e76f40891f195f8b73ccdc69846c5
  Parameters
{"project"=>"New Project"}


NoMethodError 
(undefined method `stringify_keys!' for "New Project":String):
    /vendor/rails/activerecord/lib/active_record/base.rb:2578:in 
`attributes='
    /app/controllers/projects_controller.rb:82:in `create'
    
/vendor/rails/actionpack/lib/action_controller/base.rb:1253:in `send'
    /vendor/rails/actionpack/lib/action_controller/base.rb:1253:in 
`perform_action_without_filters'
    /vendor/rails/actionpack/lib/action_controller/filters.rb:617:in `call_filters'
    
/vendor/rails/actionpack/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'
    /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in 
`perform_action_without_rescue'
    /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
    
/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
    /vendor/rails/actionpack/lib/action_controller/rescue.rb:136:in 
`perform_action_without_caching'
    /vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:13:in `perform_action'
    
/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
    /vendor/rails/activerecord/lib/active_record/query_cache.rb:8:in 
`cache'
    /vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:12:in `perform_action'
    
/vendor/rails/actionpack/lib/action_controller/base.rb:524:in `send'
    /vendor/rails/actionpack/lib/action_controller/base.rb:524:in 
`process_without_filters'
    /vendor/rails/actionpack/lib/action_controller/filters.rb:606:in `process_without_session_management_support'
    
/vendor/rails/actionpack/lib/action_controller/session_management.rb:134:in `process'
    /vendor/rails/actionpack/lib/action_controller/base.rb:392:in 
`process'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:183:in `handle_request'
    
/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:110:in `dispatch_unlocked'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:123:in 
`dispatch'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:122:in `synchronize'
    
/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:122:in `dispatch'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:132:in 
`dispatch_cgi'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:39:in `dispatch'
    
/usr/lib/ruby/1.8/mongrel/rails.rb:76:in `process'
    /usr/lib/ruby/1.8/mongrel/rails.rb:74:in 
`synchronize'
    /usr/lib/ruby/1.8/mongrel/rails.rb:74:in `process'
    
/usr/lib/ruby/1.8/mongrel.rb:159:in `process_client'
    /usr/lib/ruby/1.8/mongrel.rb:158:in 
`each'
    /usr/lib/ruby/1.8/mongrel.rb:158:in `process_client'
    
/usr/lib/ruby/1.8/mongrel.rb:285:in `run'
    /usr/lib/ruby/1.8/mongrel.rb:285:in 
`initialize'
    /usr/lib/ruby/1.8/mongrel.rb:285:in `new'
    
/usr/lib/ruby/1.8/mongrel.rb:285:in `run'
    /usr/lib/ruby/1.8/mongrel.rb:268:in 
`initialize'
    /usr/lib/ruby/1.8/mongrel.rb:268:in `new'
    
/usr/lib/ruby/1.8/mongrel.rb:268:in `run'
    /usr/lib/ruby/1.8/mongrel/configurator.rb:282:in 
`run'
    /usr/lib/ruby/1.8/mongrel/configurator.rb:281:in `each'
    
/usr/lib/ruby/1.8/mongrel/configurator.rb:281:in `run'
    /usr/bin/mongrel_rails:129:in 
`run'
    /usr/lib/ruby/1.8/mongrel/command.rb:212:in `run'
    
/usr/bin/mongrel_rails:282

Rendering 
/opt/tracks-1.7/public/500.html (500 Internal Server Error
Profile
 
 
Posted: 22 November 2010 01:10 PM   [ Ignore ]   [ # 3 ]  
Sr. Member
RankRankRankRank
Total Posts:  882
Joined  2006-10-05

AFAICS, the xml you supply in the curl command is not complete. In this case you need to put the name of the project between <name> tag, like <name>test</name></project>

Profile
 
 
Posted: 22 November 2010 09:45 PM   [ Ignore ]   [ # 4 ]  
Newbie
Rank
Total Posts:  3
Joined  2010-11-20

Ah yes! Of course thank you so much - I’m such an idiot - don’t know how I missed that.

Thanks again it’s working now.

Profile