myData
myData

Reputation: 215

API Callbacks with Ruby on Rails

I've been working with the Echosign APIs for a few weeks now and I've figured out absolutely everything that I've been wanting to do except this last bit with callbacks. I've never worked with callbacks before and have not come across a good tutorial in ruby/ruby on rails for HTTP GET requests/callbacks, etc. I've tried using a publicly accessible text file in my views folder of my rails app but no luck. If anyone could point me in the right direction, even translate what is meant in this description, I would be truly grateful. Thanks!

xml.callbackInfo do
  xml.signedDocumentUrl 'http://myserver.com/partners/web.txt'
end

A publicly accessible url to which EchoSign will do a HTTP PUT operation with the final signed PDF. HTTP authentication is supported using standard embedded syntax - i.e. http://username:[email protected]/path/to/file. EchoSign can also ping your system using HTTP GET every time there is a new agreement event. Please contact [email protected] if you wish to use this option.

Echosign CallbackInfo

Upvotes: 0

Views: 585

Answers (1)

fmendez
fmendez

Reputation: 7338

So based on what I undertand from that description, you could handle this scenario creating an action within one of you existing controllers that will handle PUT requests. Within that action you can intercept the PDF they will be sending you and process that accordingly.

On your routes.rb

put "my_controller_name/my_action"

Make sure that particular action doesn't use authentication, and provide that to the Callback URL. For instance:

xml.callbackInfo do xml.signedDocumentUrl 'http://myserver.com/my_controller/my_action' end

Hope this helps.

Regards,

Upvotes: 1

Related Questions