【发布时间】:2012-02-08 19:44:22
【问题描述】:
我从
下载了 dquail-LinkedinOauth-f169b1fhttps://github.com/dquail/LinkedinOauth
我让它工作了。问题是 - 此代码使用旧的 current-status api,它已被弃用并限制为 140 个字符
https://developer.linkedin.com/documents/status-update-api
并已被允许 700 个字符以及许多其他功能的共享 api 取代
https://developer.linkedin.com/documents/share-api
我编辑了代码以提供新的 xml 和新的 URL - 但我得到一个错误。新代码是:
private void btnUpdateStatus_Click(object sender, EventArgs e)
{
try
{
//string xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
//xml += "<current-status>" + txtNewStatus.Text + "</current-status>";
string xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><share>";
xml += "<comment>" + txtNewStatus.Text + "</comment><visibility><code>anyone</code></visibility></share>";
//string response = _oauth.APIWebRequest("PUT", "http://api.linkedin.com/v1/people/~/current-status", xml);
string response = _oauth.APIWebRequest("PUT", "http://api.linkedin.com/v1/people/~/shares", xml);
if (response == "")
txtResults.Text += "\n\rYour new status updated. view linkedin for status.";
}
catch (Exception exp)
{
txtResults.Text += "\n\rException: " + exp.Message;
}
}
我发送的 XML 是:
<?xml version="1.0" encoding="UTF-8" ?>
<share>
<comment>"Theres a lot of blood, sweat, and guts between dreams and success.", Paul Bryant</comment>
<visibility>
<code>anyone</code>
</visibility>
</share>
我得到的错误是:
“远程服务器返回错误:(405) Method Not Allowed。”
【问题讨论】: