私は WCF Rest Starter Kit をRightScale の Login APIと一緒に使用しようとしていますが、これはかなり使いやすいようです。
編集 -これは、Powershell を使用して API を使用する方法について書いたブログエントリです。
編集 - RightScale API 用の汎用 .NET ラッパーを作成 - NRightAPI
CURL を使用しているときとまったく同じように単純です。ログイン Cookie を取得するために必要なことは次のとおりです。
curl -v -c rightcookie -u ユーザー名:パスワード " https://my.rightscale.com/api/acct/accountid/login?api_version=1.0 "
そして、次の Cookie を受け取ります。
HTTP/1.1 204 No Content Date: Fri, 25
Dec 2009 12:29:24 GMT Server: Mongrel 1.1.3 Status: 204 No Content X-Runtime: 0.06121
Content-Type: text/html; charset=utf-8 Content
-Length: 0
キャッシュ制御: キャッシュなし パス=/; 安全な Vary: Accept-Encoding
ただし、次の C# コードを使用すると:
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("ユーザー名", "パスワード");
Console.WriteLine(http.Get().Content.ReadAsString());
HTTP 204 の代わりに、リダイレクトを取得します。
<a> href="https://my.rightscale.com/dashboard">リダイレクトされています <a>
WCF REST スターター キットを RighScale API と連携させるにはどうすればよいですか?