Display & Video 360 Service

  • The Display & Video 360 (DV360) service allows you to use the DV360 API within Apps Script for programmatic access.

  • This is an advanced service that requires explicit enablement before use.

  • Detailed information and reference documentation for the DV360 API can be found in the provided links.

  • Sample code is provided to demonstrate how to interact with the DV360 API, including listing partners, listing active campaigns, and updating a line item.

The Display & Video 360 (DV360) service lets you use the DV360 API in Apps Script. This API provides programmatic access to the Display & Video API.

Reference

For detailed information on this service, see the reference documentation for the DV360 API. Like all advanced services in Apps Script, the DV360 service uses the same objects, methods, and parameters as the public API. For more information, see How method signatures are determined.

To report issues and find other support, see the DV360 support guide.

Sample code

The following sample code uses version 4 of the API.

Get a list of partners

This sample logs all of the partners available in the account.

advanced/displayvideo.gs
/**
 * Logs all of the partners available in the account.
 */
functionlistPartners(){
// Retrieve the list of available partners
try{
constpartners=DisplayVideo.Partners.list();
if(partners.partners){
// Print out the ID and name of each
for(leti=0;i < partners.partners.length;i++){
constpartner=partners.partners[i];
console.log('Found partner with ID %s and name "%s".',
partner.partnerId,partner.displayName);
}
}
}catch(e){
// TODO (Developer) - Handle exception
console.log('Failed with error: %s',e.error);
}
}

Get a list of active campaigns

This sample logs names and IDs of all active campaigns. Note the use of paging tokens to retrieve the whole list.

advanced/displayvideo.gs
/**
 * Logs names and ID's of all active campaigns.
 * Note the use of paging tokens to retrieve the whole list.
 */
functionlistActiveCampaigns(){
constadvertiserId='1234567';// Replace with your advertiser ID.
letresult;
letpageToken;
try{
do{
result=DisplayVideo.Advertisers.Campaigns.list(advertiserId,{
'filter':'entityStatus="ENTITY_STATUS_ACTIVE"',
'pageToken':pageToken
});
if(result.campaigns){
for(leti=0;i < result.campaigns.length;i++){
constcampaign=result.campaigns[i];
console.log('Found campaign with ID %s and name "%s".',
campaign.campaignId,campaign.displayName);
}
}
pageToken=result.nextPageToken;
}while(pageToken);
}catch(e){
// TODO (Developer) - Handle exception
console.log('Failed with error: %s',e.error);
}
}

Update the display name of a line item

This sample updates the display name of a line item

advanced/displayvideo.gs
/**
 * Updates the display name of a line item
 */
functionupdateLineItemName(){
constadvertiserId='1234567';// Replace with your advertiser ID.
constlineItemId='123456789';//Replace with your line item ID.
constupdateMask="displayName";
constlineItemDef={displayName:'New Line Item Name (updated from Apps Script!)'};
try{
constlineItem=DisplayVideo.Advertisers.LineItems
.patch(lineItemDef,advertiserId,lineItemId,{updateMask:updateMask});
}catch(e){
// TODO (Developer) - Handle exception
console.log('Failed with error: %s',e.error);
}
}

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年10月13日 UTC.