PublisherQueryLanguageSyntaxError.UNPARSABLE error message

Skip to first unread message

Jonathan Federman

Dec 19, 2021, 4:22:37 PM12/19/21
to Google Ad Manager API Forum
Hello Google Ad Manager support,

I've added the below statement filter to my python script
but got an error message - PublisherQueryLanguageSyntaxError.UNPARSABLE @
how can I use the below filter to work correctly in PQL?
what I need to generate (API) is Ad Manager reports UI filters is any of and does/not contain operators.
'statement': "WHERE DEVICE_CATEGORY_NAME LIKE '%Smartphone%' AND AD_UNIT_NAME NOT LIKE '%fansided%'"


Ad Manager API Forum Advisor

Dec 20, 2021, 12:56:40 AM12/20/21

Hi Jonathan,


Thanks for reaching out to us.


In the UI's perspective, you may only filter on the Device category dimension by means of 'is any of' and 'is none of' which are two totally different filters. On the other hand, 'contains' and 'does not contain' filters on names or a specific word; thus making use of LIKE in that sense. In the API's perspective, filtering on IDs is highly recommended over filtering on names. Do keep in mind that if you're filtering on names, matching is case sensitive. More information on building statements here.


The ID of the Device category Smartphone is 30001 (can be retrieved by querying the Device_Category table from the PublisherQueryLanguageService) which you may filter on instead. To add further to that, if you'll try the filter syntax of 'contains' with the dimension DEVICE_CATEGORY_NAME, it will return the error INVALID_DIMENSION_FILTERS. That being said, kindly refer to the syntax I'll be showing below for your whole inquiry:


.where("DEVICE_CATEGORY_ID IN (30001) AND NOT AD_UNIT_NAME LIKE '%fansided%'");


Lastly, please note that the Ad Manager API only reflects the behaviour of the Ad Manager UI. I would recommend using the UI for this purpose by building the report queries there, as it's easier to check for compatibility issues, and retrieving them with the ReportService.getSavedQueriesByStatement method; also so you may find out the corresponding allowable filter or syntax.


Let me know how it goes or if you have any further clarifications regarding the API.




Google Logo
Yasmin Gabrielle Padua
Ad Manager API Team

Reply all
Reply to author
0 new messages