English 中文(简体)
LinkedIn API - 如何查询连接的总数?
原标题:LinkedIn API - how to query for the total number of connections?

我试图查询像这样连接的总数 :

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

并在此使用 API 示例 : < a href=" https:// developmenter. linkin.com/documents/ profile- api" rel = "no follow" > https:// developer. linkin.com/documents/ profile- api

在底部的 xml 示例下方的 xml 示例中显示此字段 :

最佳回答

要从"Profile API 获得连接计数, 您可以直接询问 API :

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

这将返回( 取决于连接计数 ) :

<?xml version="1.0" encoding="UTF-8"?>
<person>
  <num-connections>500</num-connections>
  <num-connections-capped>true</num-connections-capped>
</person>

请注意查看用户可用的字段有限制 - 请检查 < a href=> https:// developmenter. linkin. com/documents/ profile-fields" rel=“ nofollow” >Profile Fields 文档的详细内容。 例如, 无法获取连接连接 - 如果您在上面的例子中 nbqwYraDd 代表当前查看用户, 您可以使用 :

http://api.linkin.com/v1/people/id=nbqwYraDfd:(连接)

将返回:

<?xml version="1.0" encoding="UTF-8"?>
<person>
  <connections total="XXX" count="YYY" start="0">
    <person>
    ...
    </person>
  </connections>
</person>

然后通过穿行 XML (语言受抚养人) 检查总计值 。

但是,如果 nbqwYraDfd 是当前用户的连接, 或者没有连接, 您将得到 403 个响应 :

<?xml version="1.0" encoding="UTF-8"?>
<error>
  <status>403</status>
  <timestamp>1337954306491</timestamp>
  <request-id>25P44ZN249</request-id>
  <error-code>0</error-code>
  <message>Access to other member s connections denied</message>
</error>
问题回答

您无法这样做( 您无法获得特定标签的属性)

做到这一点,

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

获取回复并分析以您的编程语言返回的 XML, 并读取 < code> complete 连接 标签的属性 < code> temmunity 。

如果您只有兴趣获得总数, 我建议您通过这个查询过滤回覆的回复,

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

您使用的是什么编程语言, 可能是我可以帮助解析返回的 XML 。





相关问题
Allow RESTful DELETE method in asp.net mvc?

im currently setting up asp.net to accept DELETE http verb in the application. However, when i send "DELETE /posts/delete/1" i always get a 405 Method not allow error. I tried to take a look at ...

Most appropriate API for URL shortening service

I ve just finished an online service for shortening URLs (in php5 with Zend Framework); you can enter an URL and you get an short URL (like tinyurl and such sites). I m thinking about the API for ...

Use HTTPClient or HttpUrlConnection? [closed]

We re implementing a REST client on JRE 1.4. Seems two good options for a client REST framework are HttpClient and HttpUrlConnection. Is there a reason to use HttpClient over the JRE s ...

Why can t I find the truststore for an SSL handshake?

I m using the Spring RESTTemplate on the client side to make calls to a REST endpoint. The client in this case is a Spring app and Tomcat is the servlet container. I m running into issues making a ...

Which Http redirects status code to use?

friendfeed.com uses 302. bit.ly uses 301. I had decided to use 303. Do they behave differently in terms of support by browsers ?

Three Step Buyonline The RESTful way

We are re-developing our buyonline functionality and we are doing it the RESTful way. The process is a three step one and the customer is asked to enter data at each step. Let s say the three URL s ...