Display & Video 360 has a variety of resource limits . These limits are rarely approached, but will cause errors if reached.
Use the audit
method to get a subset of entity counts under an
advertiser. Avoid reaching account limits by auditing your advertiser on a
regular basis.
Here's how to get counts under an advertiser:
Java
// Provide the ID of the advertiser. long advertiserId = advertiser - id ; // Define the audit fields to retrieve in a comma-separated string. String readMask = "usedCampaignsCount,usedInsertionOrdersCount,usedLineItemsCount" ; // Get the audit for the advertiser. AuditAdvertiserResponse auditResponse = service . advertisers (). audit ( advertiserId ). setReadMask ( readMask ). execute (); // Display the audit results. System . out . printf ( "Audit for advertiser ID %s:%n" , advertiserId ); System . out . printf ( "Used campaigns: %s%n" , auditResponse . getUsedCampaignsCount ()); System . out . printf ( "Used insertion orders: %s%n" , auditResponse . getUsedInsertionOrdersCount ()); System . out . printf ( "Used line items: %s" , auditResponse . getUsedLineItemsCount ());
Python
# Provide the ID of the parent advertiser. advertiser_id = advertiser - id # Define the audit fields to retrieve in a comma-separated string. read_mask = "usedCampaignsCount,usedInsertionOrdersCount,usedLineItemsCount" # Generate audit. audit_response = ( service . advertisers () . audit ( advertiserId = advertiser_id , readMask = read_mask ) . execute () ) # Print audit results. print ( f "Audit for advertiser ID { advertiser_id } :" ) print ( f 'Used campaigns: { audit_response [ "usedCampaignsCount" ] } ' ) print ( f 'Used insertion orders: { audit_response [ "usedInsertionOrdersCount" ] } ' ) print ( f 'Used line items: { audit_response [ "usedLineItemsCount" ] } ' )
PHP
// Provide the ID of the advertiser. $advertiserId = advertiser-id ; // Define the audit fields to retrieve in a comma-separated string. $readMask = "usedCampaignsCount,usedInsertionOrdersCount,usedLineItemsCount"; // Configure the API request. $auditOptParams = array( 'readMask' => $readMask ); // Call the API to retrieve account limit counts. try { $auditResponse = $this->service->advertisers->audit( $advertiserId, $auditOptParams ); } catch (\Exception $e) { $this->renderError($e); return; } // Print the audit responses. printf('<p>Audit for advertiser ID %s:</p>', $advertiserId); printf('<p>Used campaigns: %s</p>', $auditResponse['usedCampaignsCount']); printf('<p>Used insertion orders: %s</p>', $auditResponse['usedInsertionOrdersCount']); printf('<p>Used line items: %s</p>', $auditResponse['usedLineItemsCount']);

