每个新订单项都需要声明是否会投放欧盟 (EU) 政治广告。Display & Video 360 API 和未提供声明的 SDF 上传操作将会失败。如需了解详情,请参阅我们的
弃用页面。
Method: advertisers.lineItems.generateDefault
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
创建一个新订单项,其设置(包括定位)继承自广告订单,并具有 ENTITY_STATUS_DRAFT
entityStatus
。如果成功,则返回新创建的订单项。系统会根据以下三个字段提供默认值:
无法使用 API 创建或更新 YouTube 及合作伙伴订单项。
HTTP 请求
POST https://displayvideo.googleapis.com/v4/advertisers/{advertiserId}/lineItems:generateDefault
网址采用 gRPC 转码语法。
路径参数
参数 |
advertiserId |
string (int64 format)
必需。相应订单项所属的广告客户的 ID。
|
请求正文
请求正文中包含结构如下的数据:
字段 |
insertionOrderId |
string (int64 format)
必需。相应订单项所属广告订单的唯一 ID。
|
displayName |
string
必需。相应订单项的显示名称。 必须采用 UTF-8 编码,大小上限为 240 字节。
|
lineItemType |
enum (LineItemType )
必需。相应订单项的类型。
|
mobileApp |
object (MobileApp )
相应订单项宣传的移动应用。 仅当 lineItemType 为 LINE_ITEM_TYPE_DISPLAY_MOBILE_APP_INSTALL 或 LINE_ITEM_TYPE_VIDEO_MOBILE_APP_INSTALL 时适用。
|
containsEuPoliticalAds |
enum (EuPoliticalAdvertisingStatus )
相应订单项是否会投放欧盟政治广告。 如果父广告客户中的 containsEuPoliticalAds 已设置为 DOES_NOT_CONTAIN_EU_POLITICAL_ADVERTISING ,则除非另行指定,否则此字段将被分配 DOES_NOT_CONTAIN_EU_POLITICAL_ADVERTISING 。然后,您可以使用界面、API 或结构化数据文件更新此字段。 创建新订单项时,必须分配此字段。否则,advertisers.lineItems.create 请求将失败。
|
响应正文
如果成功,则响应正文包含一个 LineItem
实例。
授权范围
需要以下 OAuth 范围:
https://www.googleapis.com/auth/display-video
如需了解详情,请参阅 OAuth 2.0 Overview。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-09-09。
[null,null,["最后更新时间 (UTC):2025-09-09。"],[],[],null,["- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Request body](#body.request_body)\n - [JSON representation](#body.request_body.SCHEMA_REPRESENTATION)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nCreates a new line item with settings (including targeting) inherited from the insertion order and an `ENTITY_STATUS_DRAFT` [entityStatus](/display-video/api/reference/rest/v4/advertisers.lineItems#LineItem.FIELDS.entity_status). Returns the newly created line item if successful. There are default values based on the three fields:\n\n- The insertion order's [insertionOrderType](/display-video/api/reference/rest/v4/advertisers.insertionOrders#InsertionOrder.FIELDS.insertion_order_type)\n- The insertion order's [automationType](/display-video/api/reference/rest/v4/advertisers.insertionOrders#InsertionOrderBudget.FIELDS.automation_type)\n- The given [lineItemType](/display-video/api/reference/rest/v4/advertisers.lineItems/generateDefault#body.request_body.FIELDS.line_item_type)\n\nYouTube \\& Partners line items cannot be created or updated using the API.\n\nHTTP request\n\n`POST https://displayvideo.googleapis.com/v4/advertisers/{advertiserId}/lineItems:generateDefault`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\nPath parameters\n\n| Parameters ||\n|----------------|---------------------------------------------------------------------------------------------------------------------------------------------------|\n| `advertiserId` | `string (`[int64](https://developers.google.com/discovery/v1/type-format)` format)` Required. The ID of the advertiser this line item belongs to. |\n\nRequest body\n\nThe request body contains data with the following structure:\n\n| JSON representation |\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"insertionOrderId\": string, \"displayName\": string, \"lineItemType\": enum (/display-video/api/reference/rest/v4/advertisers.lineItems#LineItemType), \"mobileApp\": { object (/display-video/api/reference/rest/v4/advertisers.lineItems#MobileApp) }, \"containsEuPoliticalAds\": enum (/display-video/api/reference/rest/v4/EuPoliticalAdvertisingStatus) } ``` |\n\n| Fields ||\n|--------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `insertionOrderId` | `string (`[int64](https://developers.google.com/discovery/v1/type-format)` format)` Required. The unique ID of the insertion order that the line item belongs to. |\n| `displayName` | `string` Required. The display name of the line item. Must be UTF-8 encoded with a maximum size of 240 bytes. |\n| `lineItemType` | `enum (`[LineItemType](/display-video/api/reference/rest/v4/advertisers.lineItems#LineItemType)`)` Required. The type of the line item. |\n| `mobileApp` | `object (`[MobileApp](/display-video/api/reference/rest/v4/advertisers.lineItems#MobileApp)`)` The mobile app promoted by the line item. This is applicable only when [lineItemType](/display-video/api/reference/rest/v4/advertisers.lineItems/generateDefault#body.request_body.FIELDS.line_item_type) is either `LINE_ITEM_TYPE_DISPLAY_MOBILE_APP_INSTALL` or `LINE_ITEM_TYPE_VIDEO_MOBILE_APP_INSTALL`. |\n| `containsEuPoliticalAds` | `enum (`[EuPoliticalAdvertisingStatus](/display-video/api/reference/rest/v4/EuPoliticalAdvertisingStatus)`)` Whether this line item will serve European Union political ads. If [containsEuPoliticalAds](/display-video/api/reference/rest/v4/advertisers#Advertiser.FIELDS.contains_eu_political_ads) has been set to `DOES_NOT_CONTAIN_EU_POLITICAL_ADVERTISING` in the parent advertiser, then this field will be assigned `DOES_NOT_CONTAIN_EU_POLITICAL_ADVERTISING` if not otherwise specified. This field can then be updated using the UI, API, or Structured Data Files. This field must be assigned when creating a new line item. Otherwise, **the `advertisers.lineItems.create` request will fail**. |\n\nResponse body\n\nIf successful, the response body contains an instance of [LineItem](/display-video/api/reference/rest/v4/advertisers.lineItems#LineItem).\n\nAuthorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/display-video`\n\nFor more information, see the [OAuth 2.0 Overview](/identity/protocols/OAuth2)."]]