Linkedin Profile API 与公开可用的 URI
我有一个包含人员姓名和 LinkedIn 个人资料 URL 的数据库。 令人烦恼的是,LinkedIn URL 没有标准格式(如 twitter),但通常采用以下形式:
1) http://www.linkedin.com/in/geoffroyondet
2) http://www.linkedin.com/profile/view?id=34178115
在我的网站上,我想显示人们的 LinkedIn 详细信息。 我的 OAuth 工作正常,对于采用第一种格式(上图)的人,我可以在我的网站上成功显示他们的 LinkedIn 数据。我正在使用 https://developer.linkedin.com/documents 中的“公共个人资料 URL”选项/profile-api
但对于第二种格式我遇到了问题。它作为“公共个人资料”无效,并且 URL 中的 ID 似乎不是上面链接中的“member_id”。
顺便说一句,如果我尝试使用这个数字 ID 作为 member_id,我会收到以下错误:
object(SimpleXMLElement)[652]
public 'status' => string '404' (length=3)
...
public 'message' => string 'Invalid member id {34178115}' (length=28)
通过使用 API 进行探索,我可以获得字母数字 id (member_id) 的唯一方法是通过成功的 API 调用(blah->person- >id)。但要成功进行 API 调用,我首先需要一个有效的 URI。所以这似乎是一个先有鸡还是先有蛋的情况。
关于如何使用上面的第二个 URL 显示 LinkedIn 数据,有什么建议吗?
I have a database of people's names and LinkedIn profile URLs.
Annoyingly there isn't a standard format for LinkedIn URLs (like twitter) but there are generally in the form of:
1) http://www.linkedin.com/in/geoffroyondet
2) http://www.linkedin.com/profile/view?id=34178115
On my site I want to display people's LinkedIn details.
I've got OAuth working fine and for people with the first format (above) I can successfully display their LinkedIn data on my site. I'm using the "Public Profile URL" option from https://developer.linkedin.com/documents/profile-api
But for the second format I'm having problems. It's invalid as a "public profile" and the ID in the URL doesn't seem to be the "member_id" from the link above.
Btw, if I try to use this numeric ID as a member_id I get the following error:
object(SimpleXMLElement)[652]
public 'status' => string '404' (length=3)
...
public 'message' => string 'Invalid member id {34178115}' (length=28)
From poking around with the API the only way I can get the alphanumeric id (member_id) is from a successful API call (blah->person->id). But to make a successful API call I first need a valid URI. So it seems to be a chicken and egg situation.
Any suggestions as to how I can display LinkedIn data by using the second URL above?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来这里有两个问题在起作用:
1)技术问题。您是正确的,您无法通过第二个 URL 通过 Profile API 检索用户的个人资料,您只能通过唯一的
public-profile-url
、通过会员 ID 或通过~
来检索当前用户的个人资料。会员 ID 与您在查询字符串中看到的数字无关 - 会员 ID 是为每个 API 应用程序的每个用户唯一生成的字母数字令牌,因此通过您的应用程序的用户 A 将拥有与通过您的应用程序的同一用户 A 不同的会员 ID我的申请。
您只是任意检索成员配置文件还是尝试从查看的经过身份验证的用户的连接中检索配置文件信息?您应该能够拉取查看者的连接
public-profile-url
,或者通过人物搜索等。2) 平台指南。基本上,您只能通过代表该用户提取信息来向查看者显示有关特定 LinkedIn 用户的个人资料信息。这意味着查看者已针对 API 进行了身份验证;您没有提及是否会出现这种情况,但遵守#2可能有助于解决#1。
Looks like there are two issues here at play:
1) The technical issues. You are correct that you cannot retrieve a user's profile via the Profile API via the second URL, you can only do it via the unique
public-profile-url
, via the member ID, or via the~
to retrieve the current user's profile.Member ID is not related to the number you see in the query string - the member ID is a alphanumeric token generated uniquely for each user for each API application, so user A via your application will have a different member ID than the same user A via my application.
Are you just retrieving the member profiles arbitrarily or are you trying to retrieve profile information from connections of the viewing authenticated user? You should be able to either pull the viewer's connections
public-profile-url
, or pull it via a People Search, etc.2) The platform guidelines. Basically, you can only show profile information about a particular LinkedIn user to viewers by pulling the information on behalf of that user. Meaning, that the viewer has authenticated against the API; you don't mention whether this will be the case, but adhering to #2 will potentially help solve #1.