In a rails 3 app, I’m using a third party API to save webcam videos. When a video is saved to their server, they give an option to send you a callback to a url you specify. From their site:
Callback
Callbacks are for advanced users who wish to be notified when a video is finished processing on the Framey servers. If you choose to receive callbacks in your account settings Framey will POST video and thumbnail URLs to your server once conversion is complete.
Here’s an example of the data that we post to your server:
"video": {
"name": "ecf7c330-549c-012e-9d34-7c6d628c53d4",
"filesize": 123456,
"duration": 15.62,
"state": "uploaded",
"views": 0,
"data": {
"my_user_id": 1,
"video_title": "Contest Submission"
},
"flv_url": "http://framey.com/videos/source/ecf7c330-549c-012e-9d34-7c6d628c53d4.flv",
"mp4_url": "http://framey.com/videos/source/ecf7c330-549c-012e-9d34-7c6d628c53d4.mp4",
"large_thumbnail_url": "http://framey.com/thumbnails/large/ecf7c330-549c-012e-9d34-7c6d628c53d4.jpg",
"medium_thumbnail_url": "http://framey.com/thumbnails/medium/ecf7c330-549c-012e-9d34-7c6d628c53d4.jpg",
"small_thumbnail_url": "http://framey.com/thumbnails/small/ecf7c330-549c-012e-9d34-7c6d628c53d4.jpg"
}
I’m working my way to understanding how to handle this, but I thought I could get proper direction from you good folks. They specify a POST method, so I have to set up a route. In my config/routes.rb file I have
post "framey/callback/"
In my app/controllers/framey_controller.rb file there is this:
class FrameyController < ApplicationController
def callback
end
end
Do I need to do something like
render :json =>????
I’m familiar with using POST via HTML forms and/or ajax. I’m not sure how to grab the JSON they send back to me.
Thanks in advance for the help and please let me know if you need more details.
In app/controllers/framey_controller.rb