title: Rails controller accept json POST request
body: <p>How can I set up my rails project to accept a json HTTP POST request?  I'm a beginner to rails and have tried different things but cant capture any data. So far this is my controller method.</p>
  
  <pre><code>def flowplayer_callback
      pars = params[:video]
  end
  </code></pre>
  
  <p>I have this in my routes.rb file:</p>
  
  <p><code>post "flowplayer_callback" =&gt; "videos#flowplayer_callback", :via =&gt; [ :post]</code></p>
  
  <p>Incoming json will look similar to this:</p>
  
  <pre><code>{"video": { "id": 85067, "seconds": 48, "failed": 0, "encodings": [{ "id": 263445, "duration": 23 }, { "id": 263446, "duration": 23 }] }
  </code></pre>
  
  <p>Edit: My issue was with devise gem trying to authenticate user in the before action.</p>