Connections Distance problem.

13 posts / 0 new
Last post
Christopher Tyler's picture
Joined: 02/15/2012
Fri, 02/17/2012 - 03:03
Connections Distance problem.

Hello All,

I have been trying to get the distance of a connection and am slowly adding information to my URL using oAuth and objective c for iOS.

I cannot seem to get the distance of a person to be returned. I realise it will always be 1 for this query but this query is going to change.

If I use:
http://api.linkedin.com/v1/people/~/connections
it works but doesn't return the distance.

If I use:
http://api.linkedin.com/v1/people/~/connections:(lastName,firstName,pictureUrl,heading,distance) or with a hash at the beginning.
It doesn't return anything at all.

Does anyone know what I am doing wrong?

On a side note, does anyone know of an updated list of field names? I notice the ones online are out of date: i.e. first-name is actually firstName. Took me ages to realise this was my problem.

Thanks very much.

Chris.

Simon Grantham's picture
Joined: 11/17/2011
Fri, 02/17/2012 - 16:32

replace distance with relation-to-viewer:(distance)

Jeremy Johnstone's picture
Developer Advocate
Joined: 04/17/2011
Mon, 02/20/2012 - 02:27

Hi Chris,

Not sure how you are getting that URL to ever return anything, with or without distance being added. The camel case names are only applicable in our JS API, when using REST they are the dash-seperated form. Using this URL:

http://api.linkedin.com/v1/people/~/connections:(first-name,last-name,headline,picture-url,distance)

Works just fine for me and returns my connections. That said, adding "distance" is actually a bit useless as the connections API only returns your first degree connections.

-Jeremy

Christopher Tyler's picture
Joined: 02/15/2012
Tue, 02/21/2012 - 06:51

Thank you both for your help. That makes a bit more sense now.

The following attempt is my overall goal. I am trying to get a list of id, first name, last name, picture URL, headline and distance for a particular company. Does anyone know what I might be doing wrong?

Thanks again.

Chris.

http://api.linkedin.com/v1/people-search:(people:(id,first-name,last-name,picture-url,headline,distance),num-results)?company-name=Company%20Name&current-company=true

Christopher Tyler's picture
Joined: 02/15/2012
Tue, 02/21/2012 - 09:27

Sorted it.

Facets are the key ;)

http://api.linkedin.com/v1/people-search:(people:(id,first-name,last-name,picture-url,headline,distance),num-results)?facet=current-company,{companyID}&sort=relevance

Thank you both again for your help.

Jeremy Johnstone's picture
Developer Advocate
Joined: 04/17/2011
Tue, 02/21/2012 - 20:50

Hi Chris,

Great! Glad you got it working. The URL from the reply #4 in this thread also works fine for me, but yes, if you want them sorted, use the URL like you have in the reply #5. :)

Enjoy!

-Jeremy

Christopher Tyler's picture
Joined: 02/15/2012
Wed, 02/22/2012 - 02:49

It worked really well. However, I came in this morning and it had stopped working. I don't know what has happened but I am now only seeing first degree connections and not 2nd. It is the same on the LinkedIn Website when you search for a company. Has it changed overnight does anyone know?

Not sure what on earth is going on.

Any thoughts would be most appreciated.

Cheers,

Chris.

Christopher Tyler's picture
Joined: 02/15/2012
Wed, 02/22/2012 - 02:57

Ok this is getting weird now. My 2nd degree connections are now back...

I don't know whether this is LinkedIn or whether this is something to do with my login. I am using LinkedIn through an app I am making and testing using the iOS simulator on my computer. I went to the linkedIn website directly and then did a search for a company I have connections with and they were then visible. I went back to my iOS simulator and they connections were back.

Anyone have any clue whether this is me or linkedIn?

Sorry for the long (veering off topic) thread!

Kirsten Jones's picture
Joined: 06/30/2011
Wed, 02/22/2012 - 07:12

Since the issue appeared on the LinkedIn website as well, it was probably an issue with our backend servers, and resolved as you were testing it. These are infrequent, but do sometimes happen. Sorry for the inconvenience, and I'm glad it's working correctly again.

Christopher Tyler's picture
Joined: 02/15/2012
Thu, 02/23/2012 - 01:46

Thanks for the reply.

This is odd...

It has done it again. This time, I tried doing what I did yesterday to regain my connections specifically, however, it didn't appear to work. I leave my development computer on over night but put it to sleep. I came in and it was doing it again so I went to google, searched for linkedIn and the company name and went straight to the top result. It showed only my 1st degree connections. This happened yesterday and resolved when I went to the main home page on linkedIn, then search using the linkedIn search to go the the company. This had no effect and must have been coincidence.

Perhaps this is a time issue? I did manage to accidentally put a search into an infinite loop last night which stopped further searches but I wouldn't have thought the number of searches was related.

I will keep trying and see if it comes back after a period of time but I can only think it might be a backend issue, perhaps with times. Any ideas?

Thanks again.

Chris

Christopher Tyler's picture
Joined: 02/15/2012
Thu, 02/23/2012 - 02:08

Ok, it is back again.

Quick update.

I have narrowed it down a little...

I tried the following to eliminate possibilities:

Logging in using a different device.
Different browsers.
Different operating systems.
Going into the company in different ways
Viewing my 1st connection's profile.
Viewing my 1st connection's connections list.

The issue finally resolved either at 10am (GMT), which was precisely when it started working (could be coincidence) or when I viewed the profile of a 2nd connection through my 1st connection.

The website starts working as does my app at the same time as would be expected which suggests a backend / login issue.

Joined: 11/13/2011
Sun, 02/26/2012 - 20:35

how to get the first-name and last-name of all connections of my 1st connection's connections ...
i was been working on it for hours but i don't find any solutions.
Can somebody help me in this...

Kirsten Jones's picture
Joined: 06/30/2011
Mon, 02/27/2012 - 07:12

Connections for connections are not available via the API in the open program.