Abhijith12 / linkedin-j

Automatically exported from code.google.com/p/linkedin-j
0 stars 0 forks source link

Support for num-connections API method in connections API #69

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
It appears the LinkedIn Connections API has an undocumented (?) number of 
connections API method that would be VERY helpful when requestions connections 
on users with many connections.

See: 
https://developer.linkedin.com/forum/please-consider-adding-getting-number-conne
ctions-api-call

The URL for the API call is: http://api.linkedin.com/v1/people/~/num-connections

I started hacking support for this into linkedin-j, but discovered 
"namespacing" issues I'm not sure how to resolve.

The XML response for the API call is:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<num-connections>12345</num-connections>

Because the element name is num-connections, the linkedin-j implementation 
unmarshals this into JAXBElement<Long>. This appears to be because the 
getProfile*() API calls return an element of the same name, and the 
unmarshaller "locks" to using the existing num-connections parsing instructions.

Just for the heck of it, I changed the element name to num-connections2 in a 
saved file, overrode the BaseLinkedInApiClient to read from the file and 
extended linkedin-j to process elements of name num-connections2, and the 
unmarshaller unmarshals it to the right object type just fine (NumConnections, 
which I created), instead of the JAXBElement<Long> specified by the existing 
createNumConnections() method by the ObjectFactory.

I've got the api call functionality and the schema implementation classes all 
implemented, but I'm not experienced enough in JAXB to get over the problem 
with the "namespacing" described above. If you know how to resolve that, I 
could send you a patch for the rest of the code.

Thanks!

Original issue reported on code.google.com by teropaan...@gmail.com on 6 Sep 2011 at 8:03