How to communicate with Rails App from external C++/C# application using REST?

Hi,

I was wondering how to communicate with my web app from e.g. a C++/C#
application. I know how to use the HTTP Rest methods but was wondering
about the following:

  • How to use POST with the authenticity_token (how do I get the
    token?)
  • How to maintain a session (i.e. login and keep the session)?

thanks!

On Jul 1, 2010, at 7:31 PM, Gerwin wrote:

thanks!


You received this message because you are subscribed to the Google G. “Ruby on Rails: Talk” group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

For any method that needs to be POSTed to, you have to turn off the
authenticity token check for that action, or that entire controller.
This is as simple as:

skip_before_filter :verify_authenticity_token

Maintaining a session is usually done manually, where you have a /login
that returns a login token, then every subsequent API request has to
include that token or the request is dropped. It’s up to the application
to keep track of who is logged in and which tokens are valid.

If you want to use a real Rails session, then whatever you use to
communicate needs to know how to work with cookies. There are plenty of
HTTP client libraries out there, you’ll need to find the one that works
w/ what you need.

Jason