如何找到给定 articleId 的特定 linkedin 文章的所有评论?

How to find all comments on a particular linkedin article given articleId?

我发布了一篇 LinkedIn article,我正在尝试检索这篇特定文章的评论。我通过右键单击评论按钮并复制 link 地址获得了 articleId。我得到 aritcleId = 7434836657526032700。我应该使用 GET http://api.linkedin.com/v1/posts/{post-id}/comments 其中 {post-id} 与 articleId 相同吗?

下面是我成功调用 AuthorizationLinkGet 后的代码。

string oauth_token = Request.QueryString["oauth_token"];
string oauth_verifier = Request.QueryString["oauth_verifier"];
if (oauth_token != null && oauth_verifier != null)
{
    Application["oauth_token"] = oauth_token;
    Application["oauth_verifier"] = oauth_verifier;

    //get access token
    _oauth.Token = oauth_token;
    _oauth.TokenSecret = Application["reuqestTokenSecret"].ToString();
    _oauth.Verifier = oauth_verifier;

    _oauth.AccessTokenGet(oauth_token);

    sLinkedInCommentsURL = "http://api.linkedin.com/v1/posts/7434836657526032700/comments";

    string response = _oauth.APIWebRequest("GET", sLinkedInCommentsURL, null);
    lblMessage.Text = response;
}

我收到以下错误:

Server Error in '/dreamplaybook' Application.

The remote server returned an error: (403) Forbidden.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Net.WebException: The remote server returned an error: (403) Forbidden.

Source Error: 


Line 433:            finally
Line 434:            {
Line 435:                webRequest.GetResponse().GetResponseStream().Close();
Line 436:                responseReader.Close();
Line 437:                responseReader = null;

Source File: c:\inetpub\calendias\dreamplaybook\App_Code\oAuthLinkedIn.cs    Line: 435 

Stack Trace: 


[WebException: The remote server returned an error: (403) Forbidden.]
   System.Net.HttpWebRequest.GetResponse() +6538872
   oAuthLinkedIn.WebResponseGet(HttpWebRequest webRequest) in c:\inetpub\calendias\dreamplaybook\App_Code\oAuthLinkedIn.cs:435
   oAuthLinkedIn.APIWebRequest(String method, String url, String postData) in c:\inetpub\calendias\dreamplaybook\App_Code\oAuthLinkedIn.cs:357
   adposter.Page_Load(Object sender, EventArgs e) in c:\inetpub\calendias\dreamplaybook\adposter.aspx.cs:282
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
   System.Web.UI.Control.OnLoad(EventArgs e) +92
   System.Web.UI.Control.LoadRecursive() +54
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34237

文章 ID 与 post id 不是同一个字段,所以这就是您看到错误的原因。 API 不允许您从出版物中获取评论。