2

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"])

Experience and Positions:

client = get_client
positions = client.profile(:fields => [:positions]).positions.all

For Educations:

client = get_client
educations = client.profile(:fields => [:educations]).educations.all

Whereas 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

For scope I set :

: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?

Amit Pal
  • 10,604
  • 26
  • 80
  • 160
  • are you sure your api key has the ability to see full profile information? They might limit the amount of data you can get from a user. This is just a guess as I'm not familiar with their API. – hummmingbear Nov 22 '15 at 06:41
  • Ah! you are correct. Now I am getting No scope undefined error in `r_fullprofile` but if I changed it to `r_basicprofile` atleast I can get the Basic profile. I read at somewhere we need to fill this form https://developer.linkedin.com/partner-programs/apply. Is that correct? to access positions and skills do I need `r_fullprofile` accessibility? for `r_fullprofile` scope do I need to fill "partner-programs" form? – Amit Pal Nov 22 '15 at 10:51
  • @AmitPal I would suggest closing this question since it seems to be solved. I would also suggest asking questions about applying for an API on a forum -- just not this site. LinkedInDevs or another medium would be of better help. – onebree Nov 23 '15 at 21:14
  • @HunterStevens I am still confused. what I put it in a comment is correct or not? – Amit Pal Nov 23 '15 at 21:33
  • Some users do not read comments, unless they are having the same issue. Most users will see your question as unanswered and just ignore it (because they do not know the answer themselves). What I am saying is, you may get the best feedback from asking about the application process in a chat room, a forum, or somewhere else. – onebree Nov 23 '15 at 21:46
  • @HunterStevens Yeah I got your point but there is no developer support forum for linkedin and I cannot see any other better option. Please do let me know if you know any other good platform ? – Amit Pal Nov 24 '15 at 10:09

1 Answers1

2

I think you need to ask Linkedin a special authorization to access this data. r_fullprofile is only for registered APIs.

  • Data that doesn't need any special authorization: r_basicprofile
  • Data that needs to apply for LinkedIn partnership program: r_fullprofile (See here)

Have a look at this documentation in Linkedin's website

To apply to Linkedin's program, visit this page

I applied this morning and they said they would come back to me within 15 days.

Good luck!

  • It seems like that I can access the `position` in `r_basicprofile` scope. "The following selection of profile fields are available to all LinkedIn developers: Basic Profile Fields, Location Fields, Position Fields. I am getting `[]` or `Mash 0`. Why is this so? – Amit Pal Nov 24 '15 at 16:00
  • If you want to access positions you need to : 1/ add "positions" in your omniauth config and 2/ retreive them with (for example) oauth.extra.raw_info.positions. You will get a hash with your user's positions. [gist here](https://gist.github.com/celine-m-s/e3f393c9b0400d1b2fe0) – Céline Martinet Sanchez Nov 24 '15 at 17:15