Early ad break notification v1
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
- Giá trị nhận dạng của luồng phát trực tiếp tương ứng mà bạn đang tạo điểm chèn quảng cáo. Giá trị nhận dạng này có thể là một trong những giá trị sau:
- "Khoá thành phần" của sự kiện phát trực tiếp.
- "Khoá thành phần tuỳ chỉnh" của sự kiện phát trực tiếp cho phép bạn quản lý không gian khoá của riêng mình bằng cách chỉ định chuỗi giá trị nhận dạng của riêng bạn.
- "Mã nguồn nội dung" và "Mã nội dung" của sự kiện phát trực tiếp.
Lưu ý: Bạn phải được cấp quyền sử dụng loại giá trị nhận dạng này. Để biết thêm thông tin, hãy liên hệ với người quản lý tài khoản của bạn.
- Thời lượng dự kiến của điểm chèn quảng cáo tiếp theo. Thời lượng cần gần với thời lượng thực tế của điểm chèn quảng cáo nhất có thể.
Ngoài các trường bắt buộc này, bạn cũng có thể gửi các thông số nhắm mục tiêu tuỳ chỉnh, tên của mẫu nhóm quảng cáo cần áp dụng hoặc dữ liệu Cue Out theo chuẩn SCTE35 (nếu có).
Điều kiện tiên quyết
Để sử dụng API EABN, bạn phải tạo một tài khoản dịch vụ và thêm tài khoản đó vào mạng Google Ad Manager.
Tạo một tài khoản dịch vụ
Để tạo tài khoản dịch vụ gọi API EABN, hãy hoàn tất các bước sau: – Nếu bạn có tài khoản Google Cloud, hãy sử dụng mô-đun IAM để tạo tài khoản dịch vụ. Để biết thêm thông tin, hãy xem bài viết Tạo và quản lý tài khoản dịch vụ. – Nếu bạn không có tài khoản Google Cloud, hãy hoàn tất các bước sau để tạo tài khoản trong Bảng điều khiển API của Google:
- Tạo dự án mới hoặc chọn dự án hiện có.
- Trên trang Thông tin xác thực, hãy nhấp vào Quản lý tài khoản dịch vụ.
- Trên trang Tài khoản dịch vụ, hãy nhấp vào TẠO TÀI KHOẢN DỊCH VỤ.
- Trên trang Tạo tài khoản dịch vụ, hãy nhập thông tin tài khoản. Sau đó, hãy nhấp vào TẠO.
Sau khi tạo tài khoản dịch vụ, hãy sao chép khoá JSON của tài khoản dùng để xác thực.
Bật API
Sau khi bạn tạo tài khoản dịch vụ, hãy cung cấp cho người quản lý tài khoản của bạn những thông tin sau để bật API cho tài khoản của bạn:
- Địa chỉ email của Tài khoản Google Cloud
- Tài khoản dịch vụ của bạn
- Mã mạng của Mạng Google Ad Manager.
Sau khi người quản lý tài khoản bật API, hãy hoàn tất các bước sau để bật API:
- Trong thư viện API của Google, hãy tìm "API Video Google Ad Manager".
- Nhấp vào BẬT.
Lưu ý: Nếu API không xuất hiện trong kết quả tìm kiếm, hãy liên hệ với người quản lý tài khoản của bạn để xác nhận rằng tài khoản của bạn đã được bật API DAI.
Sử dụng API
Bạn có thể gọi API EABN bằng các yêu cầu JSON/REST.
Ủy quyền
Để thực hiện các lệnh gọi được uỷ quyền đến API EABN, bạn cần tạo thông tin xác thực tài khoản dịch vụ OAuth2 bằng khoá JSON từ tài khoản dịch vụ và phạm vi https://www.googleapis.com/auth/video-ads
. Để biết thêm thông tin, hãy xem bài viết Sử dụng OAuth 2.0 cho ứng dụng từ máy chủ đến máy chủ.
Bạn phải thêm mã uỷ quyền thu được dưới dạng tiêu đề Auth cho mỗi lệnh gọi đến API EABN.
Để gửi thông báo về điểm chèn quảng cáo sớm, hãy gửi một yêu cầu POST đến một trong ba URL EABN hợp lệ, tuỳ thuộc vào cách bạn muốn chỉ định sự kiện phát trực tiếp. Các phần sau đây giải thích sự khác biệt giữa các URL và cung cấp ví dụ về yêu cầu và phản hồi.
URL
Có 3 URL hợp lệ để gửi thông báo chèn quảng cáo sớm. Bạn có thể sử dụng cả 3 loại để tạo điểm chèn quảng cáo (POST
) hoặc lấy danh sách điểm chèn quảng cáo được chỉ định (GET
).
Để sử dụng khoá tài sản của sự kiện phát trực tiếp, hãy sử dụng:
POST admanagervideo.googleapis.com/v1/networks/{network_code}/assets/{asset_key}/adBreaks
GET admanagervideo.googleapis.com/v1/networks/{network_code}/assets/{asset_key}/adBreaks
Để sử dụng khoá thành phần tuỳ chỉnh của sự kiện phát trực tiếp, hãy sử dụng:
POST admanagervideo.googleapis.com/v1/networks/{network_code}/customAssets/{custom_asset_key}/adBreaks
GET admanagervideo.googleapis.com/v1/networks/{network_code}/customAssets/{custom_asset_key}/adBreaks
Để sử dụng Mã nguồn nội dung và phương pháp Content ID, hãy sử dụng:
POST admanagervideo.googleapis.com/v1/networks/{network_code}/sources/{content_source_id}/content/{content_id}/adBreaks
GET admanagervideo.googleapis.com/v1/networks/{network_code}/sources/{content_source_id}/content/{content_id}/adBreaks
Đối với tất cả các tham số:
network_code
đại diện cho mã mạng của mạng Google Ad Manager.
asset_key
đại diện cho khoá thành phần xuất hiện trong trang chi tiết về sự kiện phát trực tiếp.
custom_asset_key
đại diện cho khoá thành phần tuỳ chỉnh của sự kiện phát trực tiếp.
content_source_id
biểu thị mã nhận dạng của một nguồn nội dung trong Google Ad Manager.
content_id
đại diện cho mã nhận dạng của một nội dung trong Google Ad Manager.
Lưu ý: Bạn phải liên kết cặp content_source_id
/content_id
đã chỉ định với một luồng phát trực tiếp trong Google Ad Manager.
Nội dung yêu cầu – chỉ dùng để tạo Điểm chèn quảng cáo (POST)
Đối tượng |
expectedDuration
| Bắt buộc | Thời lượng của điểm chèn quảng cáo này, sử dụng định dạng thời lượng chuẩn của Google (xx.xxx giây, trong đó xx.xxx là số giây) |
customParams
| Không bắt buộc | Cặp khoá-giá trị cần được đưa vào yêu cầu quảng cáo cho điểm chèn này để nhắm mục tiêu theo tiêu chí tuỳ chỉnh trong AM360, được phân tách bằng
=
và có sự tham gia của
&
. Ví dụ:
key=value&key2=value2,value3
Để biết thêm thông tin về cách nhắm mục tiêu, vui lòng xem bài viết Cung cấp các thông số nhắm mục tiêu cho luồng của bạn.
|
podTemplateName
| Không bắt buộc | Tên mẫu nhóm quảng cáo |
scte35CueOut
| Không bắt buộc | Dữ liệu được mã hoá định dạng base-64 từ điểm cue out scte35. Có thể bao gồm
splice_insert()
hoặc
time_signal()
lệnh. Ví dụ: |
Yêu cầu mẫu
POST admanagervideo.googleapis.com/v1/networks/.../sources/.../content/.../adBreaks
Content-Type: application/json
Authorization: Bearer …
{
"expectedDuration": "30s",
"scte35CueOut": "/DA0AAAAAAAA///wBQb+cr0AUAAeAhxDVUVJSAAAjn/PAAGlmbAICAAAAAAsoKGKNAIAmsnRfg==",
"customParams": "param1=value1¶m2=value2",
"podTemplateName": "podtemplate"
}
Nội dung phản hồi
Phần nội dung phản hồi chứa tất cả các thông số được gửi trong đối tượng adBreak
, cũng như một trường name
bổ sung chứa mã nhận dạng chuẩn trên toàn Google của điểm chèn quảng cáo đã tạo. Trường này được trả về theo định dạng sau:
networks/{network_code}/assets/{asset_key}/adBreaks/{ad_break_id}
Ví dụ về phản hồi
HTTP/1.1 200 OK
{
"name": "networks/.../assets/.../adBreaks/1",
"expectedDuration": "30s",
"scte35CueOut": "/DA0AAAAAAAA///wBQb+cr0AUAAeAhxDVUVJSAAAjn/PAAGlmbAICAAAAAAsoKGKNAIAmsnRfg==",
"customParams": "param1=value1¶m2=value2",
"podTemplateName": "podtemplate"
}
GET admanagervideo.googleapis.com/v1/networks/.../sources/.../content/.../adBreaks
Content-Type: application/json
Authorization: Bearer …
Nội dung phản hồi
Phần nội dung phản hồi chứa các điểm chèn quảng cáo cùng với trường breakState
bổ sung cho mỗi điểm chèn quảng cáo được chỉ định cho luồng. Trường breakState
hỗ trợ các giá trị sau:
// Ad break decisioning has started.
BREAK_STATE_DECISIONED
// Break has started to be delivered to end users.
BREAK_STATE_COMPLETE
Ví dụ về phản hồi
HTTP/1.1 200 OK
{
"name": "networks/.../assets/.../adBreaks/1",
"expectedDuration": "30s",
"breakState": "BREAK_STATE_COMPLETE"
}
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-08-21 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-08-21 UTC."],[[["\u003cp\u003eThe Early Ad Break Notification (EABN) API enables you to inform Google Ad Manager about upcoming ad breaks in live streams, including metadata, up to an hour in advance.\u003c/p\u003e\n"],["\u003cp\u003eTo use the EABN API, you must create a service account, add it to your Google Ad Manager network, and have the API enabled by your account manager.\u003c/p\u003e\n"],["\u003cp\u003eThe API requires the live stream identifier (asset key, custom asset key, or content source ID with content ID) and the expected ad break duration.\u003c/p\u003e\n"],["\u003cp\u003eYou can optionally include custom targeting parameters, an ad pod template name, and SCTE35 Cue Out data with your EABN requests.\u003c/p\u003e\n"],["\u003cp\u003eEABN requests are immutable, and subsequent requests for the same event are rejected until the break appears in the event's manifest.\u003c/p\u003e\n"]]],[],null,["# Early ad break notification v1\n\nUsing the Early Ad Break Notification API\n-----------------------------------------\n\n- The identifier of the corresponding live stream to which the ad break is being created. This identifier can be one of the following:\n- The \"Asset Key\" of the live stream.\n- The \"Custom Asset Key\" of the live stream, which allows you to manage your own key space by specifying your own identifier string.\n- The \"Content Source ID\" and the \"Content ID\" of the live stream.\n\nNote: You must be enabled to use this identifier type. For more information, contact your account manager.\n\n- The expected duration of the next ad break. The duration needs to be as close to the actual ad break length as possible.\n\nIn addition to these required fields, you can also send custom targeting parameters, the name of an ad pod template to apply, or SCTE35 Cue Out data, if available.\n\n### Prerequisites\n\nIn order to use the EABN API, you must create a service account and add the account to your Google Ad Manager network.\n\n#### Creating a service account\n\nTo create a service account for calling the EABN API, complete the following steps: - If you have a Google Cloud account, use the IAM module to create a service account. For more information, see [Creating and managing service accounts](//cloud.google.com/iam/docs/creating-managing-service-accounts). - If you do not have a Google Cloud account, complete the following steps to create one from the [Google API Console](//console.developers.google.com/apis/credentials/):\n\n1. Create a new project or select an existing project.\n2. In the **Credentials** page, click **Manage service accounts**.\n3. In the **Service accounts** page, click **CREATE SERVICE ACCOUNT**.\n4. In the **Create Service account** page, enter the account details. Then, click **CREATE**.\n\nOnce you have created a service account, copy the account's JSON key, which is used for authentication.\n\n#### Adding your service account to your Google Ad Manager network\n\nTo add your service account to your network, complete the steps in [Add a service account user for API access](//support.google.com/admanager/answer/6078734).\n\n### Enabling the API\n\nOnce you have created the service account, provide the following information to your account manager to enable the API for your account:\n\n- Your Google Cloud Account email address\n- Your service account\n- The Network Code of your Google Ad Manager Network.\n\nAfter the API has been enabled by your account manager, complete the following steps to enable the API:\n\n1. In the [Google API library](//console.developers.google.com/apis/library), search for \"Google Ad Manager Video API\".\n2. Click **ENABLE**.\n\nNote: If the API does not appear in the search results, contact your account manager to confirm that your account has been enabled for the DAI API.\n\n### Using the API\n\nYou can call the EABN API using JSON/REST requests.\n\n#### Authorization\n\nTo make authorized calls to the EABN API, you need to generate OAuth2 service account credentials using the JSON key from your service account and the scope `https://www.googleapis.com/auth/video-ads`. For more information, see [Using OAuth 2.0 for Server to Server Applications](https://developers.google.com/identity/protocols/oauth2/service-account).\n\nYou must include the resulting authorization token as an Auth header for each call to the EABN API.\n\n#### Sending an early ad break notification\n\nTo send an early ad break notification, send a POST request to one of the three valid EABN URLs, depending on how you prefer to specify the live stream. The following sections explain the differences between the URLs and provide request and response examples.\n\n##### URLs\n\nThere are three valid URLs for early ad break notification. You can use all three types to create an ad break (`POST`) or get the list of assigned ad breaks (`GET`).\n\nTo use the asset key of a live stream, use: \n\n POST admanagervideo.googleapis.com/v1/networks/{network_code}/assets/{asset_key}/adBreaks\n\n GET admanagervideo.googleapis.com/v1/networks/{network_code}/assets/{asset_key}/adBreaks\n\nTo use the custom asset key of a live stream, use: \n\n POST admanagervideo.googleapis.com/v1/networks/{network_code}/customAssets/{custom_asset_key}/adBreaks\n\n GET admanagervideo.googleapis.com/v1/networks/{network_code}/customAssets/{custom_asset_key}/adBreaks\n\nTo use the Content Source ID and Content ID approach, use: \n\n POST admanagervideo.googleapis.com/v1/networks/{network_code}/sources/{content_source_id}/content/{content_id}/adBreaks\n\n GET admanagervideo.googleapis.com/v1/networks/{network_code}/sources/{content_source_id}/content/{content_id}/adBreaks\n\nFor all the parameters:\n\n- `network_code` represents the network code of your Google Ad Manager network.\n- `asset_key` represents the asset key shown in your live stream details page.\n- `custom_asset_key` represents the custom asset key of your live stream.\n- `content_source_id` represents the id of a content source in Google Ad Manager.\n- `content_id` represents the id of a piece of content in Google Ad Manager.\n\nNote: The specified `content_source_id`/`content_id` pair must be associated with a live stream in Google Ad Manager.\n\n##### Request body - only used to create an Ad Break (POST)\n\n\u003cbr /\u003e\n\n| Object |||\n| \u003cbr /\u003e `expectedDuration` \u003cbr /\u003e | Required | The duration of this ad break, using Google's standard duration format (xx.xxxs where xx.xxx is the number of seconds) |\n| \u003cbr /\u003e `customParams` \u003cbr /\u003e | Optional | Key-value pairs to be included on ad requests for this break for custom criteria targeting in AM360, separated by \u003cbr /\u003e `=` and joined by `&` . Example: `key=value&key2=value2,value3` \u003cbr /\u003e For more information on targeting, see [Supply targeting parameters to your stream](//support.google.com/admanager/answer/7320899). |\n| \u003cbr /\u003e `podTemplateName` \u003cbr /\u003e | Optional | The ad pod template name |\n| \u003cbr /\u003e `scte35CueOut` \u003cbr /\u003e | Optional | Base-64-encoded data from the scte35 cue out. Can include the \u003cbr /\u003e `splice_insert()` or `time_signal()` command. Examples: - time_signal(): \u003cbr /\u003e `/DA0AAAAAAAA///wBQb+cr0AUAAeAhxDVUVJSAAAjn/PAAGlmbAICAAAAAAsoKGKNAIAmsnRfg==` \u003cbr /\u003e - splice_insert(): \u003cbr /\u003e `/DAvAAAAAAAA///wFAVIAACPf+/+c2nALv4AUsz1AAAAAAAKAAhDVUVJAAABNWLbowo=` \u003cbr /\u003e |\n|----------------------------------|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n\n\u003cbr /\u003e\n\n### Example requests\n\n##### Create an Ad Break\n\n POST admanagervideo.googleapis.com/v1/networks/.../sources/.../content/.../adBreaks\n Content-Type: application/json\n Authorization: Bearer ...\n {\n \"expectedDuration\": \"30s\",\n \"scte35CueOut\": \"/DA0AAAAAAAA///wBQb+cr0AUAAeAhxDVUVJSAAAjn/PAAGlmbAICAAAAAAsoKGKNAIAmsnRfg==\",\n \"customParams\": \"param1=value1¶m2=value2\",\n \"podTemplateName\": \"podtemplate\"\n }\n\n###### Response body\n\nThe response body contains all of the parameters sent in the `adBreak` object, as well as an additional `name` field, which contains the Google-wide standard ID of the created ad break. This field is returned in the following format: \n\n networks/{network_code}/assets/{asset_key}/adBreaks/{ad_break_id}\n\n###### Example response\n\n HTTP/1.1 200 OK\n {\n \"name\": \"networks/.../assets/.../adBreaks/1\",\n \"expectedDuration\": \"30s\",\n \"scte35CueOut\": \"/DA0AAAAAAAA///wBQb+cr0AUAAeAhxDVUVJSAAAjn/PAAGlmbAICAAAAAAsoKGKNAIAmsnRfg==\",\n \"customParams\": \"param1=value1¶m2=value2\",\n \"podTemplateName\": \"podtemplate\"\n }\n\n##### List assigned Ad Breaks\n\n GET admanagervideo.googleapis.com/v1/networks/.../sources/.../content/.../adBreaks\n Content-Type: application/json\n Authorization: Bearer ...\n\n###### Response body\n\nThe response body contains the ad breaks with an additional `breakState` field for each ad break assigned to the stream. `breakState` field supports the following values: \n\n // Ad break decisioning has started.\n BREAK_STATE_DECISIONED\n\n // Break has started to be delivered to end users.\n BREAK_STATE_COMPLETE\n\n###### Example response\n\n HTTP/1.1 200 OK\n {\n \"name\": \"networks/.../assets/.../adBreaks/1\",\n \"expectedDuration\": \"30s\",\n \"breakState\": \"BREAK_STATE_COMPLETE\"\n }"]]