1
votes

I'm replacing our LinkedIn V1 API integration with their V2 API, specifically the Company Pages endpoints described here:

https://docs.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/company-pages-migration

I've got an approved App, and a token with all of these scopes: r_ads r_ads_reporting r_basicprofile r_organization_social rw_organization_admin w_member_social w_organization_social w_share

All the first few v2 endpoints listed above work fine (getting company profile, updates) but as soon as I add their specific timeInterval parameters I get this 403 error:

Unpermitted fields present in PARAMETER: Data Processing Exception while processing fields [/timeIntervals.timeGranularityType, /timeIntervals.timeRange.end, /timeIntervals.timeRange.start]

403 implies Access Denied but my token definitely includes the specific scopes they mention are needed for the Company Pages API. What am I missing here?

Specific example: Headers: Authorization: Bearer XXXXX X-Restli-Protocol-Version: 2.0.0

Endpoint: https://api.linkedin.com/v2/organizationalEntityShareStatistics?q=organizationalEntity&organizationalEntity=urn%3Ali%3Aorganization%3AXXXXX&timeIntervals.timeGranularityType=DAY&timeIntervals.timeRange.start=1548892800000&timeIntervals.timeRange.end=1548892800000

If I remove all the timeInterval parameters it works fine, but I'm hoping to get historical data for our monthly social reporting.

2

2 Answers

7
votes

Submitted a ticket from LinkedIn support about this and got some clarification.

Under v2, the API doesn't use . notation for objects, but rather nested parenthesis. Much of their documentation still shows the . notation way (https://docs.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/company-pages-migration)

But this page: https://docs.microsoft.com/en-us/linkedin/shared/api-guide/concepts/protocol-version?context=linkedin/marketing/context has some more specifics on the correct notation for V2.

Specifically, my request above should look something like:

https://api.linkedin.com/v2/organizationalEntityShareStatistics?q=organizationalEntity&organizationalEntity=urn%3Ali%3Aorganization%3AXXXXX&timeIntervals=(timeRange:(start:1548892800000,end:1558892800000),timeGranularityType:MONTH)

Make sure the parenthesis don't get urlencoded by your platform too.

0
votes

send in headers ..

data = {
    "Authorization":       "Bearer " + token['access_token'] ,
}
response   = requests.get('https://api.linkedin.com/v2/me' , headers = data)

now works like a charm contact me if you need help!.