Use getLineItemsByStatement from "LineItemService" to retrieve all the line Items of an ad unit

543 views
Skip to first unread message

Athanasios Dimitriadis

unread,
Apr 29, 2015, 7:53:04 AM4/29/15
to google-doubleclick...@googlegroups.com
Hello, I want to get all the line items having a specific ad unit in the inventory targeting.

This is my code trying to do this

 
 // Create inventory targeting.
  $inventoryTargeting
= new InventoryTargeting();
  $inventoryTargeting
->targetedAdUnits = array('93413799');


 
// Create targeting.
  $targeting
= new Targeting();
  $targeting
->geoTargeting = new GeoTargeting();
  $targeting
->inventoryTargeting = $inventoryTargeting;
  $targeting
->dayPartTargeting = new DayPartTargeting();
  $targeting
->technologyTargeting =  new BrowserTargeting();
  $targeting
->userDomainTargeting = new UserDomainTargeting();
 
 
// Create a statement to select all line items.
  $statementBuilder
= new StatementBuilder();
  $statementBuilder
 
->Where("status = 'DELIVERING' AND
 ( LineItemType = 'STANDARD' OR LineItemType = 'SPONSORSHIP' )  AND
 Targeting = :target"
)
 
->OrderBy('id ASC')
 
->Limit('10')
   
->WithBindVariableValue('target', $targeting);


and the response is the following: Unsupported value type [Targeting] 

but the Targeting property is a valid PQL property to use in the query according the documentation:

Am I missing something defining the $targeting variable?

Chris Seeley (DFP API Team)

unread,
Apr 29, 2015, 3:28:42 PM4/29/15
to google-doubleclick...@googlegroups.com
Hi Athanasios,

Currently we only support targeting as a selectable column in the Line_Item PQL table:
https://developers.google.com/doubleclick-publishers/docs/reference/v201502/PublisherQueryLanguageService#Line_Item

It's not currently supported for filtering in either the PQL service or the LineItemService. I agree that the documentation here is incorrect - we'll get that updated.

If you need to filter on inventory targeting, you'll need to sync all the line items and then filter on your end.

Thanks,
Chris Seeley, DFP API Team

Athanasios Dimitriadis

unread,
Apr 30, 2015, 4:12:25 AM4/30/15
to google-doubleclick...@googlegroups.com
Thank you Chris for your swift reply.

May I ask you if there is an ETA on when there this filtering option will be added?

If not, is there any other way to filter the line items by the targeting values.

Thanks again

Chris Seeley (DFP API Team)

unread,
Apr 30, 2015, 3:06:02 PM4/30/15
to google-doubleclick...@googlegroups.com
There's no ETA on filtering by Targeting. For now, you can sync all the line items and filter them on your end by examining the Targeting field.

Thanks,
Chris Seeley, DFP API Team

Tomas Romero

unread,
Feb 2, 2018, 4:30:42 PM2/2/18
to Google's DoubleClick for Publishers API Forum
Hi,

Is there a way to query by targeting now (other than fetching all and filtering locally)? Just wanted to check since some years have passed since the answer, and I can't find more up to date references.

Thanks,

Tomas

Chris Seeley

unread,
Feb 2, 2018, 4:35:09 PM2/2/18
to Google's DoubleClick for Publishers API Forum
Hi Tomas,

No there isn't - you'll still need to filter locally. If it helps, you can leverage lastModifiedDateTime to keep a local sync of line items, and only retrieve line items that have changed since your last sync.

Thanks,
Chris Seeley, DFP API Team

Reply all
Reply to author
Forward
0 new messages