Adam Adam - 1 year ago 79
PHP Question

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:



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

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:

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?

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download