如何在linkedin中使用json定位多个公司共享

时间:2015-11-07 17:29:52

标签: linkedin linkedin-api

https://developer.linkedin.com/docs/company-pages#targetting_shares,targetting_shares的json格式如下。我不知道如何使用此格式定位多个共享目标或具有多个值的单个共享目标。有人知道吗?

{
  "visibility": {
    "code": "anyone"
  },
  "comment": "Testing a full company share!",
  "content": {
    "submitted-url": "https://www.example.com/content.html",
    "title": "Test Share with Content",
    "description": "content description",
    "submitted‐image-­url": "https://www.example.com/img.jpg"
  },
  "shareTargetReach": {
    "shareTargets": {
      "shareTarget": {
        "tvalues": {
          "tvalue": "na"
        },
        "code": "geos"
      }
    }
  }
}

1 个答案:

答案 0 :(得分:0)

来自文档:

  

要定位共享,请修改共享请求的POST正文,以通过在share-target-reach共享目标列表中定义一个或多个共享目标元素来描述您要定位的各个细分和值。共享目标包含代码和tvalues列表,这些tvalues表示您希望定位的各个段值。

因此,您只需在share-target中添加新的share-targets块,就像这样:

{
  "visibility": {
    "code": "anyone"
  },
  "comment": "Testing a full company share!",
  "content": {
    "submitted-url": "https://www.example.com/content.html",
    "title": "Test Share with Content",
    "description": "content description",
    "submitted‐image-­url": "https://www.example.com/img.jpg"
  },
  "shareTargetReach": {
    "shareTargets": {

      // 1st Share target
      "shareTarget": {
        "tvalues": {
          "tvalue": "D"    // 51-200 employees
        },
        "code": "companySizes"
      },

      // 2nd Share target
      "shareTarget": {
        "tvalues": {
          "tvalue": "edu",   // Education
          "tvalue": "finc"   // Finance
        },
        "code": "jobFunc"
      }

    }
  }
}

请确保删除所有//注释,这些注释只是为了帮助说明正在进行的操作,否则会阻塞JSON解析器。