如何获取Linkedin用户数据? [英] How to fetch Linkedin user data?
问题描述
我正在使用Linkedin API
来获取RoR
项目中的用户内容.我正在关注此博客.这是控制器代码:
I am using Linkedin API
to fetch user content in RoR
project. I am following this blog. Here is controller code:
基本配置文件(效果很好)
Basic profile (which works fine)
client = get_client
profile = client.profile(:fields => ["first-name", "last-name", "maiden-name", "formatted-name" ,:headline, :location, :industry, :summary, :specialties, "picture-url", "public-profile-url"])
经验和职位:
client = get_client
positions = client.profile(:fields => [:positions]).positions.all
对于教育:
client = get_client
educations = client.profile(:fields => [:educations]).educations.all
get_client
def get_client
linkedin_oauth_setting = LinkedinOauthSetting.find_by_user_id(current_user.id)
client = LinkedIn::Client.new('aaadad', 'dadada', @@config)
client.authorize_from_access(linkedin_oauth_setting.atoken, linkedin_oauth_setting.asecret)
client
end
对于范围,我设置了:
:request_token_path => '/uas/oauth/requestToken?scope=r_fullprofile'
我能够获取基本个人资料信息,但不能获取其他人的信息.对于其他字段,我将空[]
.我在这里做什么错了?
I am able to get Basic profile information but not others. For other fields I am getting empty []
. What am I doing wrong here?
推荐答案
我认为您需要请求Linkedin特殊权限才能访问此数据. r_fullprofile
仅适用于已注册的API.
I think you need to ask Linkedin a special authorization to access this data. r_fullprofile
is only for registered APIs.
- 不需要任何特殊授权的数据:r_basicprofile
- 需要申请LinkedIn合作伙伴计划的数据:r_fullprofile(请参见此处 )
在Linkedin网站上查看此文档
Have a look at this documentation in Linkedin's website
要申请Linkedin的计划,请访问此页面
To apply to Linkedin's program, visit this page
我今天早上提出申请,他们说他们会在15天内回覆我.
I applied this morning and they said they would come back to me within 15 days.
祝你好运!
这篇关于如何获取Linkedin用户数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!