Envía solicitudes

Después de que hayas configurado todo, puedes enviar solicitudes a Display & API de Video 360.

En las siguientes muestras de código, se explica cómo enviar algunas solicitudes simples:

  • Crea una línea de pedido.
  • Recupera una línea de pedido específica.

Para obtener una lista completa de métodos, consulta la documentación de referencia.

A continuación, se muestra un ejemplo de cómo crear una línea de pedido:

// Create a line item object.
LineItem lineItem = new LineItem();
lineItem
.setInsertionOrderId(insertion-order-id);
lineItem
.setDisplayName(display-name);
lineItem
.setLineItemType("LINE_ITEM_TYPE_DISPLAY_DEFAULT");
lineItem
.setEntityStatus("ENTITY_STATUS_DRAFT");

// Create and set the line item flight.
LineItemFlight lineItemFlight = new LineItemFlight();
lineItemFlight
   
.setFlightDateType("LINE_ITEM_FLIGHT_DATE_TYPE_INHERITED");
lineItem
.setFlight(lineItemFlight);

// Create and set the line item budget.
LineItemBudget lineItemBudget = new LineItemBudget();
lineItemBudget
   
.setBudgetAllocationType("LINE_ITEM_BUDGET_ALLOCATION_TYPE_FIXED");
lineItem
.setBudget(lineItemBudget);

// Create and set the pacing setting.
Pacing pacing = new Pacing();
pacing
.setPacingPeriod("PACING_PERIOD_DAILY");
pacing
.setPacingType("PACING_TYPE_EVEN");
pacing
.setDailyMaxMicros(10000L);
lineItem
.setPacing(pacing);

// Create and set the frequency cap.
FrequencyCap frequencyCap = new FrequencyCap();
frequencyCap
.setTimeUnit("TIME_UNIT_DAYS");
frequencyCap
.setTimeUnitCount(1);
frequencyCap
.setMaxImpressions(10);
lineItem
.setFrequencyCap(frequencyCap);

// Create and set the partner revenue model.
PartnerRevenueModel partnerRevenueModel = new PartnerRevenueModel();
partnerRevenueModel
   
.setMarkupType("PARTNER_REVENUE_MODEL_MARKUP_TYPE_CPM");
partnerRevenueModel
.setMarkupAmount(10000L);
lineItem
.setPartnerRevenueModel(partnerRevenueModel);

// Set the list of IDs of the creatives associated with the line item.
lineItem
.setCreativeIds(creative-ids);

// Create and set the bidding strategy.
BiddingStrategy biddingStrategy = new BiddingStrategy();
biddingStrategy
   
.setFixedBid(new FixedBidStrategy().setBidAmountMicros(100000L));
lineItem
.setBidStrategy(biddingStrategy);

// Create the line item.
LineItem response =
   service
.advertisers().lineItems().create(advertiser-id, lineItem).execute();
# Create a line item object.
line_item_obj
= {
   
'insertionOrderId' : insertion-order-id,
   
'displayName': display-name,
   
'lineItemType': 'LINE_ITEM_TYPE_DISPLAY_DEFAULT',
   
'entityStatus': 'ENTITY_STATUS_DRAFT',
   
'flight': {
       
'flightDateType': 'LINE_ITEM_FLIGHT_DATE_TYPE_INHERITED'
   
},
   
'budget': {
       
'budgetAllocationType': 'LINE_ITEM_BUDGET_ALLOCATION_TYPE_FIXED'
   
},
   
'pacing': {
       
'pacingPeriod': 'PACING_PERIOD_DAILY',
       
'pacingType': 'PACING_TYPE_EVEN',
       
'dailyMaxMicros': 10000
   
},
   
'frequencyCap': {
       
'timeUnit': 'TIME_UNIT_DAYS',
       
'timeUnitCount': 1,
       
'maxImpressions': 10
   
},
   
'partnerRevenueModel': {
       
'markupType': 'PARTNER_REVENUE_MODEL_MARKUP_TYPE_CPM',
       
'markupAmount': 10000
   
},
   
'creativeIds': creative-ids,
   
'bidStrategy': {
       
'fixedBid': {
           
'bidAmountMicros': 100000
       
}
   
}
}

# Create the line item.
lineItem
= service.advertisers().lineItems().create(
    advertiserId
=advertiser-id,
    body
=line_item_obj
).execute()
// Create a line item object.
$lineItem
= new Google_Service_DisplayVideo_LineItem();
$lineItem
->setInsertionOrderId(insertion-order-id);
$lineItem
->setDisplayName(display-name);
$lineItem
->setLineItemType('LINE_ITEM_TYPE_DISPLAY_DEFAULT');
$lineItem
->setEntityStatus('ENTITY_STATUS_DRAFT');

// Create and set the line item flight.
$flight
= new Google_Service_DisplayVideo_LineItemFlight();
$flight
->setFlightDateType('LINE_ITEM_FLIGHT_DATE_TYPE_INHERITED');
$lineItem
->setFlight($flight);

// Create and set the line item budget.
$budget
= new Google_Service_DisplayVideo_LineItemBudget();
$budget
->setBudgetAllocationType(
   
'LINE_ITEM_BUDGET_ALLOCATION_TYPE_FIXED'
);
$lineItem
->setBudget($budget);

// Create and set the pacing setting.
$pacing
= new Google_Service_DisplayVideo_Pacing();
$pacing
->setPacingPeriod('PACING_PERIOD_DAILY');
$pacing
->setPacingType('PACING_TYPE_EVEN');
$pacing
->setDailyMaxMicros(10000);
$lineItem
->setPacing($pacing);

// Create and set the frequency cap.
$frequencyCap
= new Google_Service_DisplayVideo_FrequencyCap();
$frequencyCap
->setMaxImpressions(10);
$frequencyCap
->setTimeUnit('TIME_UNIT_DAYS');
$frequencyCap
->setTimeUnitCount(1);
$lineItem
->setFrequencyCap($frequencyCap);

// Create and set the partner revenue model.
$partnerRevenueModel
=
   
new Google_Service_DisplayVideo_PartnerRevenueModel();
$partnerRevenueModel
->setMarkupType(
   
'PARTNER_REVENUE_MODEL_MARKUP_TYPE_CPM'
);
$partnerRevenueModel
->setMarkupAmount(10000);
$lineItem
->setPartnerRevenueModel($partnerRevenueModel);

// Set the list of IDs of the creatives associated with the line item.
lineItem
>setCreativeIds(creative-ids);

// Create and set the bidding strategy.
$biddingStrategy
=  new Google_Service_DisplayVideo_BiddingStrategy();
$fixedBidStrategy
= new Google_Service_DisplayVideo_FixedBidStrategy();
$fixedBidStrategy
->setBidAmountMicros(100000);
$biddingStrategy
->setFixedBid($fixedBidStrategy);
$lineItem
->setBidStrategy($biddingStrategy);

// Create the line item.
$result
= $this->service->advertisers_lineItems->create(
   
advertiser-id,
    $lineItem
);

Recupera un recurso específico

Este es un ejemplo de recuperar una línea de pedido específica:

// Get the line item.
LineItem lineItem =
   service
     
.advertisers()
     
.lineItems()
     
.get(advertiser-id, line-item-id)
     
.execute();
# Get the line item.
lineItem
= service.advertisers().lineItems.get(
    advertiserId
=advertiser-id,
    lineItemId
=line-item-id
).execute()
// Get the line item.
$lineItem
= $this->service->advertisers_lineItems->get(
   
advertiser-id,
   
line-item-id
);