开发人员指南概述

亚马逊广告 API 概览

广告活动

警告

这些接口将于 2023 年 6 月 30 日弃用。请在此日期之后使用商品推广(版本 3)广告活动。如果您希望了解更多信息,请参阅“功能弃用”页面

用于创建、读取、更新或删除广告活动。下表描述了有关 URL 空间和 支持的 HTTP 方法的服务行为,这些行为由服务管理资源提供支持。

方法 URL 用例
GET /campaigns/{campaignId} 按编号检索广告活动
GET /campaigns/extended/{campaignId} 按编号检索广告活动以及其他属性
POST /campaigns 创建一项或多项广告活动
PUT /campaigns 更新一项或多项广告活动
DELETE /campaigns/{campaignId} 存档一个特定的单独广告活动。存档的实体无法再启用。如果您希望了解更多信息,请参阅开发人员备注
GET /campaigns?startIndex={startIndex}&count={count}&campaignType={campaignType}&stateFilter={stateFilter}&name={name}&campaignIdFilter={campaignIdFilter} 根据指定条件返回广告活动列表
GET /campaigns/extended?startIndex={startIndex}&count={count}&campaignType={campaignType}&stateFilter={stateFilter}&name={name}&campaignIdFilter={campaignIdFilter} 根据指定条件返回广告活动列表,其中包含更多属性

操作

getCampaign

GET /campaigns/{campaignId}

按编号检索广告活动。请注意,此调用将返回 广告活动字段的最小集合,但比 getCampaignEx 更有效。

参数

参数名称 类型 描述
campaignId string 请求的广告活动编号

响应

状态码 响应对象
200 - success Campaign
401 - unauthorized Error
404 - campaign not found Error

getCampaignEx

GET /campaigns/extended/{campaignId}

按编号检索广告活动及其扩展字段。请注意,此调用将 返回完整的广告活动字段集合(包括服务状态 和其他只读字段),但效率不及 getCampaign

参数

参数名称 类型 指定位置 描述
campaignId string URL 路径 请求的广告活动编号

响应

状态码 响应对象
200 - success CampaignEx
401 - unauthorized Error
404 - campaign not found Error

createCampaigns

POST /campaigns

创建一项或多项广告活动。成功创建的广告活动将获得 分配的唯一 campaignId

参数

类型 指定位置 描述
Campaign 的列表 最多可创建 100 个广告活动的列表。创建广告活动所需的必填字段为:namecampaignTypetargetingTypestatedailyBudgetstartDate

响应

状态码 响应对象
207 - multi-status CampaignResponse 列表反应与输入顺序相同
401 - unauthorized Error

updateCampaigns

PUT /campaigns

更新一项或多项广告活动。广告活动使用其 campaignId 进行标识。

参数

类型 指定位置 描述
Campaign 的列表 包含最多 100 个更新的列表,其中包含 campaignId 和要修改的可变字段。可变字段列表:namestatedailyBudgetstartDateendDatepremiumBidAdjustment

响应

状态码 响应对象
207 – multi-status CampaignResponse 列表反应与输入顺序相同
401 - unauthorized Error

archiveCampaign

DELETE /campaigns/{campaignId}

将广告活动状态设置为 archived。同样的操作可 通过更新来执行,但为了完整起见,应包括在内。已存档 实体无法再启用。如果您希望了解更多信息,请参阅开发人员备注

参数

参数名称 类型 指定位置 描述
campaignId string URL 路径 要存档的广告活动的编号。

响应

状态码 响应对象
200 - success CampaignResponse
401 - unauthorized Error
404 - campaign not found Error

listCampaigns

  GET /campaigns
    ?startIndex={startIndex}
    &count={count}
    &campaignType={campaignType}
    &stateFilter={stateFilter}
    &name={name}
    &campaignIdFilter={campaignIdFilter}  

检索满足可选条件的广告活动列表。

参数

参数名称 类型 指定位置 描述
startIndex integer URL 查询 可选。结果集的 0 索引记录偏移量。默认为 0。
count integer URL 查询 可选。分页响应中要包含的记录数。默认为最大页面大小。
campaignType string URL 查询 可选。将结果限制为单一广告活动类型的广告活动。
必须为:sponsoredProducts
stateFilter string URL 查询 可选。将结果限制为指定逗号分隔列表中包含状态的广告活动。必须是以下选项之一:enabledpausedarchived。默认行为是设置为“全部包括”。
name string URL 查询 可选。将结果限制为包含指定名称的广告活动。
campaignIdFilter string URL 查询 可选。将结果限制为逗号分隔列表中指定的广告活动。

响应

状态码 响应对象
200 - success Campaign 的列表
401 - unauthorized Error

listCampaignsEx

  GET /campaigns/extended
    ?startIndex={startIndex}
    &count={count}
    &campaignType={campaignType}
    &stateFilter={stateFilter}
    &name={name}
    &campaignIdFilter={campaignIdFilter}

检索满足可选筛选条件且包含扩展字段的广告活动列表。

参数

参数名称 类型 指定位置 描述
startIndex integer URL 查询 可选。结果集的 0 索引记录偏移量。默认为 0。
count integer URL 查询 可选。分页响应中要包含的记录数。默认为最大页面大小。
campaignType string URL 查询 可选。将结果限制为单一广告活动类型的广告活动。必须为:sponsoredProducts
stateFilter string URL 查询 可选。将结果限制为指定逗号分隔列表中包含状态的广告活动。必须是以下值之一:enabled、paused、archived。默认行为是设置为“全部包括”。
name string URL 查询 可选。将结果限制为包含指定名称的广告活动。
campaignIdFilter string URL 查询 可选。将结果限制为逗号分隔列表中指定的广告活动。

响应

状态码 响应对象
200 - success CampaignEx 的列表
401 - unauthorized Error

资源表现

广告活动

{
    "title": "Campaign",
    "type": "object",
    "properties": {
       "campaignId": {
           "description": "The ID of the campaign",
           "type": "number"
       },
       "name": {
           "description": "The name of the campaign",
           "type": "string"
       },
       "campaignType": {
           "description": "Specifies the advertising product managed by this campaign",
           "type": "string",
           "oneOf": ["sponsoredProducts"]
       },
       "targetingType": {
           "description": "Differentiates between a keyword-targeted and automatically targeted campaign",
           "type": "string",
           "oneOf": ["manual", "auto"]
       },
       "state": {
           "description": "Advertiser-specified state of the campaign",
           "type": "string",
           "oneOf": ["enabled", "paused", "archived"]
       },
       "dailyBudget": {
           "description": "Daily budget for the campaign",
           "type": "number",
           "minimum": 1.00
       },
       "startDate": {
           "description": "The date the campaign will go or went live as YYYYMMDD",
           "type": "string"
       },
       "endDate": {
           "description": "The optional date the campaign will stop running as YYYYMMDD",
           "type": "string"
       },
       "premiumBidAdjustment": {
           "description": "When enabled, Amazon will increase the default bid for your ads that are eligible to appear in this placement.See developer notes for more information.",
           "type": "boolean"
       }
    }
}

CampaignEx

{
    "title": "CampaignEx",
    "type": "object",
    "properties": {
       "campaignId": {
           "description": "The ID of the campaign",
           "type": "number"
       },
       "name": {
           "description": "The name of the campaign",
           "type": "string"
       },
       "campaignType": {
           "description": "Specifies the advertising product managed by this campaign",
           "type": "string",
           "oneOf": ["sponsoredProducts"]
       },
       "targetingType": {
           "description": "Differentiates between a keyword-targeted and automatically targeted campaign",
           "type": "string",
           "oneOf": ["manual", "auto"]
       },
       "state": {
           "description": "Advertiser-specified state of the campaign",
           "type": "string",
           "oneOf": ["enabled", "paused", "archived"]
       },
       "dailyBudget": {
           "description": "Daily budget for the campaign in dollars",
           "type": "number",
           "minimum": 1.00
       },
       "startDate": {
           "description": "The date the campaign will go or went live as YYYYMMDD",
           "type": "string"
       },
       "endDate": {
           "description": "The optional date the campaign will stop running as YYYYMMDD",
           "type": "string"
       },
       "premiumBidAdjustment": {
    "description": "When enabled, Amazon will increase the default bid for your ads that are eligible to appear in this placement.See developer notes for more information.",
           "type": "boolean"
       },
       "placement": {
           "description": "Ad placement.Only returned when segment is set to placement.",
           "type": "string",
           "oneOf": ["Top of Search on-Amazon", "Other on-Amazon"]
       },
       "creationDate": {
           "description": "The date the campaign was created as epoch time in milliseconds",
           "type": "number"
       },
       "lastUpdatedDate": {
           "description": "The date the campaign was last updated as epoch time in milliseconds",
           "type": "number"
       },
       "servingStatus": {
           "description": "The computed status, accounting for campaign out of budget, policy violations, etc.See developer notes for more information.",
           "type": "string",
"oneOf": ["CAMPAIGN_ARCHIVED", "CAMPAIGN_PAUSED", "CAMPAIGN_STATUS_ENABLED","ADVERTISER_PAYMENT_FAILURE", "CAMPAIGN_OUT_OF_BUDGET", "ACCOUNT_OUT_OF_BUDGET"]
       }
    }
}

CampaignResponse

{
    "title": "CampaignResponse",
    "type": "object",
    "properties": {
       "campaignId": {
           "description": "The ID of the campaign that was created/updated, if successful",
           "type": "number"
       },
       "code": {
           "description": "An enumerated success or error code for machine use.",
           "type": "string"
       },
       "details": {
           "description": "A human-readable description of the error, if unsuccessful",
           "type": "string"
       }
    }
}

错误

请参阅开发人员备注中的错误对象返回 格式。