如何获取Linkedin用户数据?
我正在使用Linkedin API
来获取RoR
项目中的用户内容。 我正在关注这个博客。 这是控制器代码:
基本档案(工作正常)
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'
我能够获得基本个人资料信息,但不能获得其他信息。 对于其他领域,我变空了[]
。 我在这做错了什么?
我想你需要向Linkedin提出特殊授权才能访问这些数据。 r_fullprofile
仅适用于已注册的API。
- 不需要任何特殊授权的数据:r_basicprofile
- 需要申请LinkedIn合作伙伴计划的数据:r_fullprofile( 见这里 )
在Linkedin的网站上查看此文档
要申请Linkedin的计划, 请访问此页面
我今天早上申请,他们说他们会在15天内回复我。
祝好运!