简体   繁体   中英

Webservice POST not displaying requested parameters using rest client in rails 2.3.8

I have headers set as Accept application/json and content-type application/json for my POST webservice. Follwing are the requested parameters:

 { 
  "OccupantID": 162921,
  "BuildingID": 13294,
  "QuizID": 397,
  "Score": 3,
  "Result": "fail"
 }

routes.rb

  map.connect '', :controller => 'quiz_v2', :action => 'record_quiz_result', :conditions => { :method => :post }

When I try to see params in my controller's action

  def record_quiz_result
   p params
  end
 It returned just controller_name and action_name

I dont know what is happening here, May be I missed something. Any Help

Goto Headers => Custom Header 

1.Content-Type as name and application/x-www-form-urlencoded as value and save it.

2.Now enter ur params in body which should be available and accessible through the params hash in rails

Hope it helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM