LinkedIn API - how to query for the total number of connections?

前端 未结 2 1527
挽巷
挽巷 2021-01-20 05:48

I am trying to query for the total number of connections like this:

/people/id=QM86-RIKjb:(connections total)

and using the API example her

2条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-20 06:21

    To get the connection count from the Profile API, you can ask the API directly:

    http://api.linkedin.com/v1/people/id=nbqwYraDfd:(num-connections,num-connections-capped)

    Which will return (depending on the connection count):

    
    
      500
      true
    
    

    Keep in mind that there are restrictions on the fields available to the viewing user - check the Profile Fields document for details. For instance, it is not possible to get 'connections of connections' - if, in your example above, nbqwYraDfd represents the current viewing user, you can use:

    http://api.linkedin.com/v1/people/id=nbqwYraDfd:(connections)

    Which will return:

    
    
      
        
        ...
        
      
    
    

    And then check the value of total by traversing the XML (language dependant).

    However, if nbqwYraDfd is a connection of the current user, or a non-connection, you will get a 403 response:

    
    
      403
      1337954306491
      25P44ZN249
      0
      Access to other member's connections denied
    
    

提交回复
热议问题