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.
def flowplayer_callback
pars = params[:video]
end
I have this in my routes.rb file:
post "flowplayer_callback" => "videos#flowplayer_callback", :via => [ :post]
Incoming json will look similar to this:
{"video": { "id": 85067, "seconds": 48, "failed": 0, "encodings": [{ "id": 263445, "duration": 23 }, { "id": 263446, "duration": 23 }] }
Edit: My issue was with devise gem trying to authenticate user in the before action.
:via => [:post]. Other than that, it looks good. What's NOT working about it? Have you tried printing the params on the page? What do the logs look like?