2011-12-20 25 views
4

我開始閱讀和最近測試LinkedIn的API,我使用時field selectorsLinkedIn API場選擇器

我的目標是使用API​​來獲取有關人員的信息,比如它的第一姓,名有問題,例如當前公司和標題。

默認情況下,people-search api只返回id,first-name and last-name

我讀過,我可以用一些field-selectors細化的結果,但我的問題是,how do i use the field selectors with the parameters i want them to match aswell.

我已經試過:

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

但它不工作,我拋出一個例外說它是一個Bad request

我必須提出兩個要求嗎?

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) 

預先感謝您的關注,如果它不適合任何XDA模式,請隨時編輯我的主題。

回答

6

此API現在只適用於LinkedIn合作伙伴

documentation,下面的圖案是在該人使用的搜索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 

所有查詢字符串參數都是可選(完整列表位於文檔頁面),指定的字段選擇器可在this page上找到。

您需要指定字段選擇器是「人」的原因是People Search API還可以返回可用於搜索UI的「構面」,以提供有關結果的信息。在這種情況下,我們將返回的位置方面,我們可以解析,變成一組複選框,類似於LinkedIn.com搜索頁面上找到:

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 

您可以測試所有這些查詢的上REST Console