简体   繁体   中英

Linkedin Profile API vs Publicly Available URIs

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM