I am trying to use the WCF Rest Starter Kit with the RightScale Login API , which seems pretty easy to use.
Edit - here's the entry blog I wrote about using Powershell to use the API.
Edit - Created a common .NET wrapper for the RightScale API - NRightAPI
It is just as easy as using CURL. In order to get the login cookie, I need to do the following:
curl -v -c rightcookie -u username: password " https://my.rightscale.com/api/acct/accountid/login?api_version=1.0 "
And I get the following cookie:
HTTP / 1.1 204 No data Date: Fri, 25
December 2009 12:29:24 GMT Server: Mongrel 1.1.3 Status: 204 No X-Runtime content: 0.06121
Content-Type: text / html; charset = utf-8
Content-Length: 0
Cache-control: no-cache
Added cookie _session_id = "488a8d9493579b9473fbcfb94b3a7b8e5e3" for the domain my.rightscale.com, path /, expire 0
Set-Cookie: _session_id = 488a8d9493579b9473fbcfb94b3a7b8e5e3; Path = /; secure Vary: Accept-Encoding
However, when I use the following C # code:
HttpClient http = new HttpClient (" https://my.rightscale.com/api/accountid/login?api_version=1.0 ");
http.TransportSettings.UseDefaultCredentials = false;
http.TransportSettings.MaximumAutomaticRedirections = 0;
http.TransportSettings.Credentials = new NetworkCredential ("username", "password");
(http.Get () Content.ReadAsString ().);
Instead of HTTP 204, I get a redirect:
You are <a> href = "https://my.rightscale.com/dashboard"> redirected <a>
How do I get a WCF REST starter kit that works with the RighScale API?
source share