2

I have a LinkedIn Developer App connected to a company page with an approved 'Marketing Developer Platform' product. I'm trying to call any of the organization endpoints ("organizationPageStatistics", "organizationalEntityFollowerStatistics", etc.) from a Google Sheets script and I have the 'rw_organization_admin' permission and the token is valid for that permission. Each time I get a 404 response with 'does not exist' in the message.

Here is an example of the URL I'm using;

https://api.linkedin.com/v2/organizationalEntityFollowerStatistics?q=organizationalEntity&organizationalEntity=urn%3Ali%3Aorganisation%3A{appId}&oauth2_access_token={access_token}

This is what I have in the Google Sheets script;

  var data = {"X-Restli-Protocol-Version":"2.0.0"};
  var options = {'method' : 'post',
                 'contentType': 'application/json',
                 'payload' : JSON.stringify(data)
                };
  
  var LIData = UrlFetchApp.fetch("https://api.linkedin.com/v2/organizationalEntityFollowerStatistics?q=organizationalEntity&organizationalEntity="+LINKEDIN_COMPANY_URN_URLENCODED+"&oauth2_access_token="+LINKEDIN_ACCESS_TOKEN, options);

  Logger.log(JSON.parse(LIData)); 

Any help is greatly appreciated.

1 Answers1

0

Seems you do not need to encode the organizationalEntity field, this curl API call works fine (This example use the Test Organizations but works fine with real company page also):

curl -H "Authorization: Bearer <aouth_token>" \
"https://api.linkedin.com/v2/organizationalEntityFollowerStatistics?q=organizationalEntity&organizationalEntity=urn:li:organization:2414183"

or

https://api.linkedin.com/v2/organizationalEntityFollowerStatistics?q=organizationalEntity&organizationalEntity=urn:li:organization:2414183&oauth2_access_token=<access_token>

will return :

{
  "paging": {
    "start": 0,
    "count": 10,
    "links": []
  },
  "elements": [
    {
      "followerCountsByAssociationType": [
        {
          "followerCounts": {
            "organicFollowerCount": 894,
            "paidFollowerCount": 0
          }
        },
        {
          "followerCounts": {
            "organicFollowerCount": 150,
            "paidFollowerCount": 0
          },
          "associationType": "EMPLOYEE"
        }
      ],
      "followerCountsByRegion": [
        {
          "region": "urn:li:region:84",
          "followerCounts": {
            "organicFollowerCount": 101,
            "paidFollowerCount": 0
          }
        },
        {
          "region": "urn:li:region:7127",
......

}
Matteo
  • 37,680
  • 11
  • 100
  • 115