【问题标题】:Sparkle LinkedIn API: summary and skills fields always emptySparkle LinkedIn API:摘要和技能字段始终为空
【发布时间】:2017-12-16 20:21:12
【问题描述】:

我正在尝试使用 Sparkle.LinkedIn 从 LinkedIn API 获取摘要和技能字段。 一切正常,我可以阅读 Headline、FirstName 和 LastName 字段,但 SkillsSummary、Industry、DateOfBirth和其他字段总是为空,即使 LinkedIn 个人资料肯定有这些字段

这是我在用户已经通过身份验证并且我拥有令牌时使用的代码:

var fields = FieldSelector.For<Person>()
    .WithId()
    .WithFirstName()
    .WithLastName()
    .WithEmailAddress()
    .WithHeadline()
    .WithPictureUrl()
    .WithPublicProfileUrl()
    .WithSummary()
    .WithIndustry()
    .WithDateOfBirth()
    .WithSkills();

var config = new LinkedInApiConfiguration("api-key", "key-secret");    
var api = new LinkedInApi(config);    
if(!string.IsNullOrEmpty(error) || !string.IsNullOrEmpty(error_description))
{
    Response.Write(error + "<br/>" + error_description);
}
else
{
    var redirectUrl = "my-redirect-url";
    var userToken = api.OAuth2.GetAccessToken(code, redirectUrl);    
    var acceptLanguages = new string[] { "it-IT","en-US", };

    var user = new UserAuthorization(userToken.AccessToken);
    Person profile = api.Profiles.GetMyProfile(user,acceptLanguages,fields);
    Response.Write(profile.Headline + "<br/>");
    Response.Write(profile.Summary + "<br/>"); //always empty
    Response.Write(profile.Industry + "<br/>"); //always empty
    Response.Write(profile.PictureUrl + "<br/>");  //always empty
    if(profile.Skills!=null)  //always null
    {
       foreach (var sk in profile.Skills.Skill)
       {
           Response.Write(sk.SkillName.Name + "<br/>");
       }
    }
    Response.Write(profile.Lastname + "<br/>");
    Response.Write(profile.DateOfBirth.Year + "<br/>"); //always empty

}

如何同时检索摘要和技能字段?

【问题讨论】:

  • 代码看起来不错。这似乎是 LinkedIn 的一个细微差别,也许是 Achille 所暗示的授权。
  • 在 Internet 中搜索似乎在 Linked API 中有一个未记录的重大变化,因为他们正在关闭对开放 API 的大多数字段的访问。只有LinkedIn的大公司合作伙伴可以访问它。这是我读到的,如果有人可以确认的话,

标签: c# api linkedin


【解决方案1】:

很遗憾,我无法评论您的帖子,但我可以说这当然不是逻辑顺序错误。快速查看它,我会尝试的一件事是将字段选择器中的所有内容替换为.WithAllFields()

我在这里How to get summary of connections for LinkedIn API using omniauth-linkedin gem 发现的一件事是,您可能需要比现在更多的权限(我从未使用过这个 api,所以我不确定)

【讨论】:

  • 感谢 Achille,之前尝试过 .WithAllFields() 但结果相同
  • 嗨,今天我将尝试在我的机器上复制你的代码,以便我可以做更多的调试,你能否分享代码的其他部分(注意不要显示任何敏感数据)所以我的代码'll be testing 可以和你的一样吗?另外,您是否从 nuget 导入了库?
  • 是的,我已经从 nuget 导入,在 webform 网站上,非常简单快捷。顺便说一句,我在 LinkedIn 官方网站上找到了一份声明,他们确认他们不再与任何人共享数据,他们必须逐个审查应用程序以允许阅读权限!即使是用户授予应用程序读取他/她的数据的权限......嗯。稍后我会更新我的帖子
  • 好的,很遗憾听到这个消息,API 受到限制总是很糟糕):
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-07-18
  • 2017-06-26
  • 2015-07-24
  • 2020-07-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多