IN.API.PeopleSearch()

JavaScript SDK

This API does not currently provide access to search facet data. To access facet data, consider using the Raw API. Note the absence of any identifier - a People Search is conducted across the entire LinkedIn network from the perspective of the currently signed-in member. 

JavaScript
IN.API.PeopleSearch().fields(fields).params(paramsObject).result(resultCallback)

IN.API.PeopleSearch().fields(field1, field2, field3).params(paramsObject).result(resultCallback)

IN.API.PeopleSearch().fields([field1, field2]).params(paramsObject).result(resultCallback)
  • fields() (optional) - Array {String}, Argument List {String}
    Specifies the fields to retrieve based on the Profile API. If not specified, the default fields from the server will be used, subject to change.  A full list of available fields can be found in Profile Fields.
  • params() (optional) - Object
    The key/value pairs to use as parameters for the search. A full list of parameters is available in the People Search API documentation.

Basic Example

JavaScript
IN.API.PeopleSearch().params({"first-name":"Barack"}).result(doMyThing)

No fields are included, so the results include the standard fields (currently headline, id, firstName, lastName,, location, siteStandardProfileRequest, apiStandardProfileRequest, pictureUrl, url, industry). An example result would then be a JavaScript object which is a list of person objects.  An example of the person object looks like this:

Sample Response
{  
   "headline":"President of the United States",
   "id":"NhZXBl_O6f",
   "lastName":"Obama",
 "pictureUrl":"http://media.linkedin.com/mpr/mprx/0_fsPnURNRhLhk_Ue2fjKLUZkB2FL6TOe2S4bdUZz61GA9Ysxu_y_sz4THGW5JGJWhaMleN0F61-Dg",
   "location":{
       "name":"Washington, DC","country":{"code":"us"}
   },
   "siteStandardProfileRequest":{
      "url":"http://www.linkedin.com/profile?viewProfile=&key=11554268&authToken=3KMh&authType=name&trk=api*a124520*s132954*"
   },
   "apiStandardProfileRequest":{
      "headers":{
         "values":[{
            "name":"x-li-auth-token",
            "value":"name:3KMh"}
         ],"_total":1},
      "url":"http://api.linkedin.com/v1/people/NhZXBl_O6f"
    },
    "industry":"Executive Branch",
    "firstName":"Barack"
}

More Specific Fields

The PeopleSearch call supports a .fields() method which allows you to specify which fields you want returned, instead of just getting the default fields. If you want to understand what fields are available for each person, see the Profile Fields documentation, as well as the Field Selector information to understand how to express your request correctly.

JavaScript
IN.API.PeopleSearch()
    .fields(["firstName","headline"])
    .result(function(result) { 
         alert JSON.stringify(result)) 
    }

In this example we're asking for two specific fields (once you start specifying Profile Fields, your return is limited to just the fields you have asked for.  The defaults are overriden entirely. In addition, instead of calling a separate function, an inline function has been created for the results. The results for this case would be much smaller, and the results would be shown in an alert window to the user.

Sample response
{  
   "headline":"President of the United States",
   "firstName":"Barack"
}