如何使用 Restsharp 在 C# 中 post 使用 flickr api?
How can I post using the flickr api in c# using Restsharp?
在此代码中
我如何使用数据
在 C# 中创建 oauth_signature 部分
通过更改每个请求的 oauth_timestamp 和 oauth_nonce 信息并在每个请求中使用它们
我怎样才能创建 oauth_signature
public class TestController
{
[HttpGet("GetFlickr")]
public ActionResult GetFlickr()
{
var client = new RestClient("https://api.flickr.com/services/upload/");
client.Timeout = -1;
var request = new RestRequest(RestSharp.Method.POST);
request.AddHeader("Authorization", "OAuth
oauth_consumer_key=\"consumer_key\"," +
"oauth_token=\"token_key\"," +
"oauth_signature_method=\"HMAC-SHA1\"," +
"oauth_timestamp=\"1627559028\"," +
"oauth_nonce=\"562eiIaQgdi\"," +
"oauth_version=\"1.0\"," +
"oauth_callback=\"callback_url\"," +
"oauth_verifier=\"verifier_key\"," +
"oauth_signature=\"9xJLlvaSQScgHxiw5AlXtWALuC4%3D\"");
request.AddFile("photo", "/C:/Users/oguzm/OneDrive/Masaüstü/Ekran Alıntısı.PNG");
IRestResponse response = client.Execute(request);
return Ok(response);
}
}
https://github.com/rhargreaves/oauth-dotnetcore
在这里使用库
我成功地创建了签名我解决了我的问题
我写了一个小库给想用的人
https://github.com/oguzmolla/FlickrAPILibrary
在此代码中 我如何使用数据
在 C# 中创建 oauth_signature 部分通过更改每个请求的 oauth_timestamp 和 oauth_nonce 信息并在每个请求中使用它们 我怎样才能创建 oauth_signature
public class TestController
{
[HttpGet("GetFlickr")]
public ActionResult GetFlickr()
{
var client = new RestClient("https://api.flickr.com/services/upload/");
client.Timeout = -1;
var request = new RestRequest(RestSharp.Method.POST);
request.AddHeader("Authorization", "OAuth
oauth_consumer_key=\"consumer_key\"," +
"oauth_token=\"token_key\"," +
"oauth_signature_method=\"HMAC-SHA1\"," +
"oauth_timestamp=\"1627559028\"," +
"oauth_nonce=\"562eiIaQgdi\"," +
"oauth_version=\"1.0\"," +
"oauth_callback=\"callback_url\"," +
"oauth_verifier=\"verifier_key\"," +
"oauth_signature=\"9xJLlvaSQScgHxiw5AlXtWALuC4%3D\"");
request.AddFile("photo", "/C:/Users/oguzm/OneDrive/Masaüstü/Ekran Alıntısı.PNG");
IRestResponse response = client.Execute(request);
return Ok(response);
}
}
https://github.com/rhargreaves/oauth-dotnetcore
在这里使用库 我成功地创建了签名我解决了我的问题
我写了一个小库给想用的人 https://github.com/oguzmolla/FlickrAPILibrary