简体   繁体   English

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

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

I published a LinkedIn article and I'm trying to retrieve the comments for this particular article. 我发表了LinkedIn文章,并试图检索此特定文章的评论。 I obtained the articleId by right clicking on the comments button and copying the link address. 我通过右键单击评论按钮并复制链接地址来获得articleId I get aritcleId = 7434836657526032700. Should I use GET http://api.linkedin.com/v1/posts/{post-id}/comments where {post-id} is same as articleId? 我得到aritcleId = 7434836657526032700.我应该使用GET http://api.linkedin.com/v1/posts/{post-id}/comments ,其中{post-id}与articleId相同吗?

Below is my code after successful AuthorizationLinkGet call. 以下是成功的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;
}

I receive following error: 我收到以下错误:

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

Article ID is not the same field as post id, so that is why you are getting the error you see. 文章ID与文章ID不在同一字段,因此这就是为什么看到错误的原因。 The API does not allow you to get comments from publications. 该API不允许您从出版物中获取评论。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM