Using Linkedin API to see new connections of my 1st degree connections

1.2k views Asked by At

Is it possible to use the Linkedin API to see new connections made by my (authenticated user) 1st degree connections?

Using a call like:

GET http://api.linkedin.com/v1/people-search?facet=network,S  

I can search for second degree connections. However, the goal is to get new connections of selected 1st degree connections.

Any help much appreciated.

2

There are 2 answers

1
naveen goyal On BEST ANSWER

You can get new connection with using this URL http://api.linkedin.com/v1/people/~/connections?modified=new&modified-since=1267401600000

Where modified-since is the time you last made the request.

you can check more detail here https://developer.linkedin.com/documents/connections-api

I think Linkedin Change URL : New URL is : https://developer-programs.linkedin.com/documents/connections-api

0
Shawn_Fan On

Yes. It's quite easy to see other people or your connections using the following code I wrote. If you want to search for other people's new connection, simply replace the 'Me' with other people's id.

//Function that displays the member's updates:
function onLinkedInAuth() { 
  IN.API.MemberUpdates("me") 
     .params({"type": "CONN", "count": 1}) // get the five most-recent Shares for the viewer and EjDUWNoC3C
     .result(displayNetworkUpdates)
     .error(displayNetworkUpdatesError);
}

//Note: You can only see your friend's most recent connection
function displayNetworkUpdates(updates) { 
    var profileDiv = document.getElementById("networkupdates");
    var conns = updates.values[0].updateContent.person.connections; // the person sharing content
    var man = conns.values[0];
    profileDiv.innerHTML += "<p>" + man.firstName + " " + man.lastName  +".</p>";
}

See when I look for people/my new connection, I only ask for 1. This is because LinkedIn API is not generous enough to grant more privilege. They ONLY ALLOW US TO VIEW 1 CONNECTION/ most recent connection.

Also, just so you know, find your friend's id is quite easy as well. Just search for connections of yours using the following code, then you can obtain a list of your connections and their IDs.

//Functions that displays users' connections
function onLinkedInAuth() {
  IN.API.Connections("me") 
    .fields("firstName", "lastName", "industry", "id")
    .params({"start": 10, "count": 5}) // start begins at 0
    .result(displayConnections)
    .error(displayConnectionsErrors);
}

function displayConnections(connections) {
  var connectionsDiv = document.getElementById("connections");

  var start = connections._start + 1; // because humans count from 1, not 0.
  var range = connections._start + connections._count;
  connectionsDiv.innerHTML = "<p>Displaying " + start + "-" + range + " of " + connections._total + " connections.</p>";


  var members = connections.values; // The list of members you are connected to
  for (var member in members) {
    connectionsDiv.innerHTML += "<p>" + members[member].firstName + " " + members[member].lastName
      + " works in the " + members[member].industry + " industry"+ "    ID: " + members[member].id ;
  }     
}

And if you want to see a list of new connections of your friend, I have one approach but haven't attempted yet. You can query LinkedIn database once/sec, and keep tracking of who is adding new connection. This is far beyond 100% accurate, but at least it gives you a list of connections.

Again, LinkedIn says you cannot store any information you obtained through API. That approach might be bad. If you query the server once/sec, probably your IP will be blocked as well.... so .... I conclude LinkedIn API is very limited.