透過 Display &Video 360 建立的所有委刊項Video 360 API 最初是以草稿建立 時間。在草稿狀態中,委刊項不會放送廣告,因此您可以 調整設定和指定目標,而不做出這些變更會影響任何目前廣告 放送。本頁說明您應採取哪些步驟來確認資料行 項目已準備好放送廣告,以及如何將狀態更新為有效。
啟用前應採取的行動
由於委刊項是廣告收益的支出方式 購買及放送廣告時,必須確保委刊項 則在啟用時正常放送廣告。使用前,請考量以下事項 啟用委刊項:
- 確認檔期設定正確無誤:檢查委刊項的
flight
欄位,確認 委刊項設定正確委刊項的檔期可以自訂為 或是由上層廣告訂單沿用的委刊項 - 確認沒有導致委刊項無法放送的警告:
使用
advertisers.lineItems.get
擷取委刊項資源 然後查看warningMessages
欄位,確認 委刊項沒有任何可能妨礙委刊項放送的警告。LineItemWarningMessage
列舉會標註 警告。 - 確認所有父項資源也都處於有效狀態:有效委刊項
如果上層廣告客戶、廣告活動或插入項目是上層廣告客戶、廣告活動或廣告,則不會開始放送廣告
訂單未啟用。請使用指令中的
GET
方法擷取這些資源 廣告客戶、廣告活動和 廣告訂單服務。
啟用委刊項
透過更新 entityStatus
欄位來啟用委刊項的
ENTITY_STATUS_ACTIVE
。您可以為個別委刊項更新這個欄位
使用 advertisers.lineItems.patch
方法和多行時建立一行
某個廣告客戶內的多個項目
advertisers.lineItems.bulkUpdate
。
以下範例說明如何使用 bulkUpdate
啟動
多個委刊項:
Java
// Create the line item structure. LineItem targetLineItem = new LineItem(); targetLineItem.setEntityStatus("ENTITY_STATUS_ACTIVE"); // Create the bulk update request body. BulkUpdateLineItemsRequest requestBody = new BulkUpdateLineItemsRequest(); requestBody.setLineItemIds(line-item-ids); requestBody.setTargetLineItem(targetLineItem); requestBody.setUpdateMask("entityStatus"); // Configure the bulk update request. LineItems.BulkUpdate request = service.advertisers().lineItems() .bulkUpdate(advertiser-id, requestBody); // Update the line items. BulkUpdateLineItemsResponse response = request.execute(); // Display the line items that were updated, failed, and skipped. if (response.getUpdatedLineItemIds() != null) { System.out.printf( "The following line item IDs were successfully updated: %s.\n", Arrays.toString(response.getUpdatedLineItemIds().toArray())); } if (response.getFailedLineItemIds() != null) { System.out.printf("The following line item IDs failed to update: %s.\n", Arrays.toString(response.getFailedLineItemIds().toArray())); if (response.getErrors() != null) { System.out.printf( "The failed updates were caused by the following errors: %s.\n", Arrays.toString(response.getErrors().toArray())); } } if (response.getSkippedLineItemIds() != null) { System.out.printf( "The following line items IDs were skipped in the update: %s.\n", Arrays.toString(response.getSkippedLineItemIds().toArray())); }
Python
# Create a line item object with only updated entity status. line_item_obj = { 'entityStatus': 'ENTITY_STATUS_ACTIVE' } # Build the bulk update request. bulk_update_request = { 'lineItemIds': line-item-ids, 'targetLineItem': line_item_obj, 'updateMask': "entityStatus" } # Update the line items. response = service.advertisers().lineItems().bulkUpdate( advertiserId=advertiser-id, body=bulk_update_request ).execute() # Display the line items that were updated, failed, and skipped. if 'updatedLineItemIds' in response: print("The following line item IDs were updated: %s" % response['updatedLineItemIds']) if 'failedLineItemIds' in response: print("The following line item IDs failed to update: %s" % response['failedLineItemIds']) if 'errors' in response: print("The failed updates were caused by the following errors:") for error in response["errors"]: print("Error code: %s, Message: %s" % (error["code"], error["message"])) if 'skippedLineItemIds' in response: print("The following line items IDs were skipped in the update:: %s" % response['skippedLineItemIds'])
PHP
// Create request body. $body = new Google_Service_DisplayVideo_BulkUpdateLineItemsRequest(); $body->setLineItemIds(line-item-ids); // Create target line item with updated fields. $lineItem = new Google_Service_DisplayVideo_LineItem(); $lineItem->setEntityStatus('ENTITY_STATUS_ACTIVE'); $body->setTargetLineItem($lineItem); // Set update mask in request body. $body->setUpdateMask("entityStatus"); // Call the API, updating the entity status for the identified line item. $response = $service->advertisers_lineItems->bulkUpdate( advertiser-id, $body ); // Display the line items that were updated, failed, and skipped. if (!empty($response->getUpdatedLineItemIds())) { printf('The following line item IDs were updated:\n'); foreach ($response->getUpdatedLineItemIds() as $id) { printf('%s\n', $id); } } if (!empty($response->getFailedLineItemIds())) { print('The following line item IDs failed to update:\n'); foreach ($response->getFailedLineItemIds() as $id) { printf('%s\n', $id); } if (!empty($response->getErrors())) { print('The failed updates were caused by the following errors:\n'); foreach ($response->getErrors() as $error) { printf( 'Error Code: %s, Message: %s\n', $error->getCode(), $error->getMessage() ); } } } if (!empty($response->getSkippedLineItemIds())) { print('The following line item IDs were skipped in the update:\n'); foreach ($response->getSkippedLineItemIds() as $id) { printf('%s\n', $id); } }