linkedin v2 api:结合投影和装饰

时间:2017-08-23 20:34:08

标签: linkedin linkedin-api

使用Postman,我可以查询端点以检索共享上的注释:

https://api.linkedin.com/v2/socialActions/urn:li:share:myshare/comments?count=35

我们有像

这样的回复
{
  "paging": {
    "count": 10,
    "start": 0
  },
  "elements": [
    {
      "actor": "urn:li:person:x",
      "created": {
        "actor": "urn:li:person:x",
        "time": 1472051509000
      },
      "commentsSummary": {
        "totalFirstLevelComments": 2,
        "aggregatedTotalComments": 2,
        "selectedComments": [
          "urn:li:comment:(urn:li:activity:x,x)",
          "urn:li:comment:(urn:li:activity:x,x)"
        ]
      },
      "id": "x",
      "lastModified": {
        "actor": "urn:li:person:x",
        "time": 1472051509000
      },
      "message": {
        "attributes": [

        ],
        "text": "This is a comment"
      },
      "object": "urn:li:share:x"
    }
  ]
}

我以为我可以使用像:

这样的请求
https://api.linkedin.com/v2/socialActions/urn:li:share:myshare/comments?count=35&projection=(actor~)

或者

https://api.linkedin.com/v2/socialActions/urn:li:share:myshare/comments?count=35&fields=actor,id,message,created,lastModified,object&projection=(actor~)

但是这些都会在身体中返回200 OK{} ...... Wat。

文档在详细信息和示例上非常过时。他们甚至没有提到是否(或如何)结合投影和装饰。

如何将actor信息“装饰”到评论对象中,以便我不必发出额外的请求来获取它?

1 个答案:

答案 0 :(得分:2)

这是我解决问题的方法:

https://api.linkedin.com/v2/socialActions/urn:li:share:777777777/comments?count=35&projection=(elements*(*,actor~,created(*,actor~),lastModified(*,actor~)))