Search code examples
apilinkedin-api

LinkedIn API Field Selectors


I started reading and testing LinkedIn's API recently and i am having problems when using field selectors

My goal is to use the API to fetch information about people, like its first-name,last-name,current-company and title for example.

By default,the people-search api returns only id,first-name and last-name.

I've read that,i can use some field-selectors to refine the result, but my question is, how do i use the field selectors with the parameters i want them to match aswell.

I've tried :

http://api.linkedin.com/v1/people-search?first-name=marcello&last-name=lins:(id,first-name,last-name,current-company,title)

But it does not work,throws me an exception saying that it is a Bad request.

Do i have to make two requests ?

1: https://api.linkedin.com/v1/people-search?first-name=marcello&lastname=lins
2: https://api.linkedin.com/v1/people-search?:(first-name,last-name,current-company,title)

Thanks in advance for the attention and feel free to edit my thread if it is not fitting any XDA-Pattern.


Solution

  • This API is now only available for the Linkedin Partners

    Per the documentation, the following pattern is used on the People Search API:

    http://api.linkedin.com/v1/people-search:(people:(id,first-name,last-name,picture-url,headline),num-results)?first-name=Steve&last-name=Smith
    

    All of the querystring parameters are optional (a full list is on the docs page), and the specified field selectors can be found on this page.

    The reason that you need to specify that the field selectors are 'people' is that the People Search API can also return 'facets' which can be used in your search UI to give information about the results. In this case, we'll return the location facets which we could parse and turn into a set of checkboxes, similar to those found on the LinkedIn.com search page:

    http://api.linkedin.com/v1/people-search:(facets:(code,buckets:(code,name)),people:(id,first-name,last-name,picture-url,headline),num-results)?first-name=Steve&last-name=Smith&facets=location
    

    You can test all of these queries on the REST Console.