0

I'm working on a simple app to programmatically retrieve ads performance within Linkedin. I have general API experience but this is the first time i get my feet wet with the Linkedin API.

One example from Linkedin API documentation suggest something that would get me started:

GET https://api.linkedin.com/v2/adAnalyticsV2?q=analytics&dateRange.start.month=1&dateRange.start.day=1&dateRange.start.year=2016&timeGranularity=MONTHLY&pivot=CREATIVE&campaigns=urn:li:sponsoredCampaign:112466001

I am encountering two problems:

First this example implies that you already know the campaign ID. However I am unable to find a way to retrieve a list of campaign ID's for a given account.

Second, if I manually pull a campaign ID, I receive an error: "{"serviceErrorCode":2,"message":"Too many fields requested. Maximum possible fields to request: 20","status":400}". Pretty clear error. A little research tells me that by adding the parameter "&fields=" I will be able to limit my query to less than 20 field (I really need only a dozen anyway) but I can't find and documentation regarding the names of the fields available.

Any help or pointer will be appreciated.

1
  • Ok, with a few attempts i found an answer to my first question: Basically this url will provide what I was looking for: api.linkedin.com/v2/… In this case I limit the result to only 3 fields and only retrieve active campaigns, it seems to work. I'm still looking for a list fo fields for the campaign performance. Commented Jan 22, 2022 at 18:06

2 Answers 2

0

url = 'https://api.linkedin.com/v2/adCampaignsV2' pass headers Authorization: f'Bearer {access_token}'

use this to retrieve campaign details for an account, To get the access token,

  1. go to this "https://www.linkedin.com/oauth/v2/authorization?response_type=code&client_id={your_client_id}&redirect_uri={your_redirect_uri}&scope=r_ads+rw_ads"
  2. grab the code and get access token through "https://www.linkedin.com/oauth/v2/accessToken" this endpoint
Sign up to request clarification or add additional context in comments.

Comments

-2

please refer the link below scroll down where you ill see the field names mentioned as metrics , these are the fields.

https://learn.microsoft.com/en-us/linkedin/marketing/integrations/ads-reporting/ads-reporting?tabs=http#analytics-finder

1 Comment

While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.