开发人员指南概述

亚马逊广告 API 概览

广告活动否定关键词

警告

这些接口将于 2023 年 6 月 30 日弃用。请在此日期之后使用商品推广(版本 3)广告活动否定关键词。有关更多信息,请参阅“功能弃用”页面

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

方法 URL 使用案例
GET /campaignNegativeKeywords/{keywordId} 按编号检索广告活动级别的否定关键词
GET /campaignNegativeKeywords/extended/{keywordId} 按编号检广告活动级别的否定关键词,其中包含更多属性
POST /campaignNegativeKeywords 创建一个或多个广告活动级别的否定关键词
PUT /campaignNegativeKeywords 更新一个或多个广告活动级别的否定关键词
DELETE /campaignNegativeKeywords/{keywordId} 删除单个广告活动级别的否定关键词。
GET /campaignNegativeKeywords?startIndex={startIndex}&count={count}&campaignType={campaignType}&matchTypeFilter={matchTypeFilter}&keywordText={keywordText}&campaignIdFilter={campaignIdFilter} 根据指定条件返回广告活动级别的否定关键词列表
GET /campaignNegativeKeywords/extended?startIndex={startIndex}&count={count}&campaignType={campaignType}&matchTypeFilter={matchTypeFilter}&keywordText={keywordText}&campaignIdFilter={campaignIdFilter} 根据指定条件返回广告活动级别的否定关键词列表,其中包含更多属性

操作

getCampaignNegativeKeyword

GET /campaignNegativeKeywords/{keywordId}

按编号检索广告活动否定关键词。请注意,此调用将返回 关键词字段的最小集合,但效率优于 getCampaignNegativeKeywordEx.

参数

参数名称 类型 描述
keywordId string 请求的关键词编号

响应

状态代码 响应对象
200 - success CampaignNegativeKeyword
401 - unauthorized Error
404 - keyword not found Error

getCampaignNegativeKeywordEx

GET /campaignNegativeKeywords/extended/{keywordId}

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

参数

参数名称 类型 指定位置 描述
keywordId string URL 路径 请求的关键词编号

响应

状态代码 响应对象
200 - success CampaignNegativeKeywordEx
401 - unauthorized Error
404 - keyword not found Error

createCampaignNegativeKeywords

POST /campaignNegativeKeywords

创建一个或多个广告活动否定关键词。成功创建的关键词将获得 分配的唯一 keywordId

参数

类型 指定位置 描述
CampaignNegativeKeyword 的列表 最多可创建 1000 个广告活动否定关键词的列表。创建关键词时的必填字段包括:campaignIdkeywordTextmatchTypestate

响应

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

updateCampaignNegativeKeywords

PUT /campaignNegativeKeywords

更新一个或多个广告活动否定关键词。关键词需使用 keywordId 进行识别。

参数

类型 指定位置 描述
CampaignNegativeKeyword 的列表 包含最多 1000 项更新的列表,其中包含 keywordId 和要修改的可变字段。可变字段:state

响应

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

removeCampaignNegativeKeyword

DELETE /campaignNegativeKeywords/{keywordId}

将广告活动否定关键词状态设置为“deleted”。同样的 操作可通过更新状态来执行,但为了完整起见,应包括在内 。

注意: 虽然广告组级别的关键词(同时包括可竞价关键词和否定关键词) 支持暂停 (paused) 和已存档 (archived) 状态,但广告活动的否定关键词 只支持已启用 (enabled ) 或已删除 (deleted) 状态。已删除 (deleted) 状态表示永久删除了 广告活动的否定关键词。通过编号检索已删除的实体 将导致 404 错误。

参数

参数名称 类型 指定位置 描述
keywordId string URL 路径 要删除的关键词的编号。

响应

状态代码 响应对象
200 - success CampaignNegativeKeywordResponse
401 - unauthorized Error
404 - keyword not found Error

listCampaignNegativeKeywords

GET /campaignNegativeKeywords/                                             
  ?startIndex={startIndex}              
  &count={count}                        
  &campaignType={campaignType}          
  &matchTypeFilter={matchTypeFilter}    
  &keywordText={keywordText}                                                   
  &campaignIdFilter={campaignIdFilter}

检索满足可选条件的否定关键词列表。

参数

参数名称 类型 指定位置 描述
startIndex integer URL 查询 可选。结果集的 0 索引记录偏移量。默认为 0。
count integer URL 查询 可选。分页响应中要包含的记录数。默认为最大页面大小。
campaignType string URL 查询 可选。将结果限制为属于指定类型的广告活动的关键词。必须为:sponsoredProducts
matchTypeFilter string URL 查询 可选。将结果限制为指定逗号分隔列表中包含匹配类型的关键词。Valid 有效值为:negativePhrasenegativeExact
keywordText string URL 查询 可选。将结果限制为包含指定 keywordText 的关键词。
campaignIdFilter string URL 查询 可选。将结果限制为逗号分隔列表中指定的广告活动包含的关键词。

响应

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

listCampaignNegativeKeywordsEx

GET /campaignNegativeKeywords/extended                                       
  ?startIndex={startIndex}                
  &count={count}                          
  &matchTypeFilter={matchTypeFilter}      
  &keywordText={keywordText}              
  &campaignIdFilter={campaignIdFilter}

检索满足可选条件且包含扩展字段的广告活动否定关键词列表 。

参数

参数名称 类型 指定位置 描述
startIndex integer URL 查询 可选。结果集的 0 索引记录偏移量。默认为 0。
count integer URL 查询 可选。分页响应中要包含的记录数。默认为最大页面大小。
campaignType string URL 查询 可选。将结果限制为属于指定类型的广告活动的关键词。必须为:sponsoredProducts
matchTypeFilter string URL 查询 可选。将结果限制为指定逗号分隔列表中包含匹配类型的关键词。Valid 有效值为:negativePhrasenegativeExact
keywordText string URL 查询 可选。将结果限制为包含指定 keywordText 的关键词。
campaignIdFilter string URL 查询 可选。将结果限制为逗号分隔列表中指定的广告活动包含的关键词。

响应

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

资源表现

CampaignNegativeKeyword

{
    "title": "CampaignNegativeKeyword",
    "type": "object",
    "properties": {
       "keywordId": {
           "description": "The ID of the keyword",
           "type": "number"
       },
       "campaignId": {
           "description": "The ID of the campaign to which this keyword belongs",
           "type": "number"
       },
       "state": {
           "description": "Advertiser-specified state of the keyword",
           "type": "string",
           "oneOf": ["enabled", "deleted"]
       },
       "keywordText": {
           "description": "The expression to match against search queries",
           "type": "string"
       },
       "matchType": {
           "description": "The match type used to match the keyword to search query",
           "type": "string",
           "oneOf": ["negativeExact", "negativePhrase"]
       }
   }
}

CampaignNegativeKeywordEx

{
    "title": "CampaignNegativeKeywordEx",
    "type": "object",
    "properties": {
       "keywordId": {
           "description": "The ID of the keyword",
           "type": "number"
       },
       "campaignId": {
           "description": "The ID of the campaign to which this keyword belongs",
           "type": "number"
       },
       "state": {
           "description": "Advertiser-specified state of the keyword",
           "type": "string",
           "oneOf": ["enabled", "deleted"]
       },
       "keywordText": {
           "description": "The expression to match against search queries",
           "type": "string"
       },
       "matchType": {
           "description": "The match type used to match the keyword to search query",
           "type": "string",
           "oneOf": ["negativeExact", "negativePhrase"]
       },
       "creationDate": {
           "description": "The date the ad group was created as epoch time in milliseconds",
           "type": "number"
       },
       "lastUpdatedDate": {
           "description": "The date the ad group was last updated as epoch time in milliseconds",
           "type": "number"
       },
       "servingStatus": {
           "description": "The computed status, accounting for out of budget, policy violations, etc.See developer notes for more information.",
           "type": "string",
           "oneOf": ["TARGETING_CLAUSE_STATUS_LIVE"]
       }
   }
}

CampaignNegativeKeywordResponse

{
    "title": "CampaignNegativeKeywordResponse",
    "type": "object",
    "properties": {
       "keywordId": {
           "description": "The ID of the keyword 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"
       }
    }
}

错误

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