-2
REST OAuth 2.0をサポートするWebサイトからプロジェクトの詳細をダウンロードするためのC#コンソールアプリケーションを作成しようとしています。アクセストークンを使用してウェブサイトへのリクエスト/レスポンス呼び出しを行うにはどうすればよいですか?ここ は私のコードです:アクセストークンを使用してC#のWebサイトからプロジェクトのリストを取得するにはどうすればよいですか?
public string token = "4bjskfa2-b37d-6244-8413-3358b18c91b6";
public async Task GetProjectsAsync()
{
try
{
HttpClient client = new HttpClient();
var projects = "https://app.rakenapp.com/api/v2/projects?" + token;
client.CancelPendingRequests();
HttpResponseMessage output = await client.GetAsync(projects);
if (output.IsSuccessStatusCode)
{
string response = await output.Content.ReadAsStringAsync();
project proj = JsonConvert.DeserializeObject<project>(response);
if (proj != null)
{
Console.WriteLine(proj.name); // You will get the projects here.
}
}
}
catch (Exception ex)
{
//catching the exception
}
}
問題は何?また、なぜクライアントが作成されたばかりの保留中の要求を取り消したいのですか? –