1

I am using the library linkedin-j to use the linkedin API in Java. I am testing the search functionality but it seems that only return people near me, and I need to search people who has not relation with me, or people from any university or something like that.

I am using this code:

 Map<SearchParameter, String> searchParameters = new EnumMap<SearchParameter, String>(SearchParameter.class);
 searchParameters.put(SearchParameter.KEYWORDS, "University of X");        

 People people = client.searchPeople(searchParameters);
 System.out.println("Total search result:" + people.getCount());

 for (Person person : people.getPersonList()) {
     System.out.println(person.getId() + ":" + person.getFirstName() + " " +
     person.getLastName() + ":" + person.getHeadline());
 }

It returns me nothing.

However if i put my lastname in the parameters.

    searchParameters.put(SearchParameter.LAST_NAME, "MYLASTNAME");

It returns me only me.

Please, how can i search more people with this API?

4

2 回答 2

0

您必须寻找开发人员以获取更多详细信息。根据我的链接,我们只能访问 1 级连接。您可以使用 LinkedIn REST 控制台尝试更多...希望这对您有所帮助。

于 2013-02-09T10:48:16.073 回答
0

要访问网络外的人,请使用 Factes

 if(!searchParameters.isEmpty()) {
              System.out.println("Searching for users.");
             facets  = new ArrayList<Parameter<FacetType,String>>();
             facets.add(new Parameter<FacetType, String>(FacetType.NETWORK, RelationshipCodes.FIRST_DEGREE_CONNECTIONS));
              facets.add(new Parameter<FacetType, String>(FacetType.NETWORK, RelationshipCodes.OUT_OF_NETWORK_CONNECTIONS));
              facets.add(new Parameter<FacetType, String>(FacetType.NETWORK, RelationshipCodes.SECOND_DEGREE_CONNECTIONS));



            }

使用 Follow Api 访问除名字、姓氏、id 之外的配置文件属性。

 peopleSearch = client.searchPeople(searchParameters, EnumSet.of(ProfileField.FIRST_NAME, ProfileField.LAST_NAME, ProfileField.ID, ProfileField.HEADLINE,ProfileField.DISTANCE), EnumSet.of(FacetField.NAME, FacetField.CODE, FacetField.BUCKET_NAME, FacetField.BUCKET_CODE, FacetField.BUCKET_COUNT), facets);
于 2013-07-25T07:12:56.083 回答