0

I am fetching the audiene count

https://api.linkedin.com/v2/audienceCountsV2?q=targetingCriteriaV2&targetingCriteria=(include:(and:List((or:(urn%3Ali%3AadTargetingFacet%3Alocations:List(urn%3Ali%3Acountry%3Aal))))),exclude:(and:List((or:(urn%3Ali%3AadTargetingFacet%3AageRange:List(urn%3Ali%3AageRange%3A(18%2C24)))),(or:(urn%3Ali%3AadTargetingFacet%3Adegrees:List(urn%3Ali%3Adegree%3A2049))))))

As per ref: https://learn.microsoft.com/en-us/linkedin/shared/references/v2/ads/targeting-criteria-facet-urns The Values for Age Range allowed are : urn:li:ageRange:(18,24) urn:li:ageRange:(25,34) urn:li:ageRange:(35,54) urn:li:ageRange:(55, 2147483647)

I am getting a 400 error

{
    "serviceErrorCode": 0,
    "message": "Invalid query parameters passed to request",
    "status": 400
}

Could you help me whether the encoding for date range in the query is correct or wrong?

Code Guy
  • 3,059
  • 2
  • 30
  • 74
  • Is there a response body in the 400 response? It might give you a hint as to what is failing validation. – Michael Keane Galloway May 23 '22 at 21:23
  • { "serviceErrorCode": 0, "message": "Invalid query parameters passed to request", "status": 400 } – Code Guy May 24 '22 at 02:52
  • I tried plugging your query string into my test harness. I'm not able to get it to work either. One thing I did notice is that the facet for age ranges is plural, you have `urn%3Ali%3AadTargetingFacet%3AageRange`. Another thing that I noticed is in the ad [budget call](https://learn.microsoft.com/en-us/linkedin/marketing/integrations/ads-reporting/ad-budget-pricing?tabs=http#encoded-sample-request), the parenthesis for ranges are URL encoded as well – Michael Keane Galloway May 25 '22 at 01:07

1 Answers1

0

In the documentation to, it states: enter image description here

You're attempting to use age range in an exclude, and it can only be used in the include portion of targeting.