过去一周我一直在努力在 LinkedIn 中添加评论,但我还没有得到解决方案
protected void Page_Load(object sender, EventArgs e)
{
string ConsumerKey = "**********";
string ConsumerSecret = "**********";
string Token = "**********";
string TokenSecret = "**********";
string xmlContent = "<?xml version='1.0' encoding='UTF-8'?>" + Environment.NewLine +
"<comment>" + Environment.NewLine +
"<text>Check out</text>" + Environment.NewLine +
"</comment>";
byte[] dataBytes = Encoding.Default.GetBytes(xmlContent);
var postData = new Dictionary<string, string>()
{
{"key1","value1"}
};
String requestUrl = "http://api.linkedin.com/v1/posts/{post-id}/comments?oauth_token=" + Token;
RestClient rc = new RestClient();
RestRequest request = new RestRequest(requestUrl, Method.POST);
request.AddHeader("Content-Type", "application/xml");
request.AddHeader("x-li-format", "xml");
request.RequestFormat = DataFormat.Xml;
request.AddBody(xmlContent);
RestResponse restResponse = (RestResponse)rc.Execute(request);
ResponseStatus responseStatus = restResponse.ResponseStatus;
}
我收到一个错误
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<error>
<status>401</status>
<timestamp>1375175962003</timestamp>
<request-id>10K340J5W6</request-id>
<error-code>0</error-code>
<message>[unauthorized]. ssl_required</message>
</error>
我想要解决方案。提前致谢。