how to get companies id from linkedin jsapi

允我心安 提交于 2019-12-04 02:29:50

问题


i was trying to get companies id from linkedin using jsapi,iam using below url

"/company-search:(companies:(id,name))?keywords=ibm%20oracle%20infosys"

i got ids of some other companies

{"companies": {
"_count": 10,
"_start": 0,
"_total": 1079,
"values": [
{
  "id": 6005,
  "name": "Sonata Software"
},
{
  "id": 5983,
  "name": "QLogic"
},
{
  "id": 39626,
  "name": "Prosoft Technology Group"
},
{
  "id": 6290,
  "name": "BCC"
},
{
  "id": 23367,
  "name": "Goldstone Technologies"
},
{
  "id": 36655,
  "name": "SoftwareONE"
},
{
  "id": 10951,
  "name": "Sirius Computer Solutions"
},
{
  "id": 10046,
  "name": "ITWorx"
},
{
  "id": 7833,
  "name": "SYSTIME"
},
{
  "id": 57561,
  "name": "ZSL Inc"
}
]
}}

how to get companies id for more than one comapny at a time


回答1:


Use JSON.stringify plus a regexp for this:

JSON.stringify({"companies": {
"_count": 10,
"_start": 0,
"_total": 1079,
"values": [
{
  "id": 6005,
  "name": "Sonata Software"
},
{
  "id": 5983,
  "name": "QLogic"
},
{
  "id": 39626,
  "name": "Prosoft Technology Group"
},
{
  "id": 6290,
  "name": "BCC"
},
{
  "id": 23367,
  "name": "Goldstone Technologies"
},
{
  "id": 36655,
  "name": "SoftwareONE"
},
{
  "id": 10951,
  "name": "Sirius Computer Solutions"
},
{
  "id": 10046,
  "name": "ITWorx"
},
{
  "id": 7833,
  "name": "SYSTIME"
},
{
  "id": 57561,
  "name": "ZSL Inc"
}
]
}}).match(/id..\d+/g) 

/* Returns:
["id":6005", "id":5983", "id":39626", "id":6290", "id":23367", "id":36655", "id":10951", "id":10046", "id":7833", "id":57561"] 
*/


来源:https://stackoverflow.com/questions/15108544/how-to-get-companies-id-from-linkedin-jsapi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!