2012-01-12 14 views
0

に現在のステータスから変更私はそれが働いてしまったC#LinkedInのAPI dquailのOauth新しい<share> API

https://github.com/dquail/LinkedinOauth

からdquail-LinkedinOauth-f169b1fをダウンロードしました。 https://developer.linkedin.com/documents/status-update-api

このコードは廃止されている古い現在のステータスAPIを使用し、140文字に制限

と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)方法"

答えて

0

PUTを使用していますが、共有APIにはメソッドとしてPOSTが必要です。

405は意味「あなたはHTTPメソッドを使用しているこのエンドポイントはサポートしていません」

を限り理由として、あなたは新しい共有を追加している、現在のステータスを更新していません。 https://developer.linkedin.com/documents/share-api

+0

Kirsten - ありがとう、ありがとう、ありがとう!あなたの答えを正しいものにしました。 – Bubba