开发人员指南概述

亚马逊广告 API 概览

配置文件

站点包含特定于地区的属性,例如 countryCodecurrencyCodetimezone。这些属性决定了广告 API 的行为,例如日程安排、预算和账单。因此,广告主如果有与多个站点关联的账户(例如: Amazon.com、Amazon.co.uk、Amazon.co.jp),每个站点只能关联一个配置文件。每个配置文件必须与唯一的 Login with Amazon 账户关联,而每个 Login with Amazon 账户需要一个唯一的电子邮件地址。在生成 API 认证令牌时,您必须使用与您管理广告活动的国际站点对应的正确配置文件。

认证令牌用于获取与广告主关联的所有配置文件。在调用 API 时,配置文件 ID 将传递到标头中。报告和所有实体管理操作都与单个配置文件关联。广告主的各个站点不能关联多个配置文件。

配置文件与唯一的配置文件 ID 相关联。在所有 API 调用的标头中,都需要使用管理范围。使用您的配置文件 ID 作为标头中管理范围 (Amazon-Advertising-API-Scope) 的值。要检索您的配置文件 ID,请调用用于列出与您正在使用的访问令牌关联的配置文件的 API。

GET /v1/profiles

    Host: advertising-api.amazon.com
    Authorization: Bearer Atza|IQEBLjAsAhRmHjNgHpi0U...
    Amazon-Advertising-API-ClientId: amzn1.application-oa2-client.a8358a60…
    Amazon-Advertising-API-Scope: 1834670349683089580748
    Content-Type: application/json

以下方法用于读取和更新配置文件。下 表描述了有关 URL 空间和 支持的 HTTP 方法的服务行为,这些行为由服务管理资源提供支持。

方法 URL 用例
GET /profiles 检索与身份验证令牌关联的所有配置文件。
GET /profiles/{profileId} 按 ID 检索配置文件
PUT /profiles/ 更新一个或多个配置文件

地区配置文件时区代码

在 ‘Time zone’ 列中使用确切的文本和格式来指定正确的 时区。

地区 时区
US America/Los_Angeles
CA America/Los_Angeles
UK Europe/London
DE Europe/Paris
FR Europe/Paris
ES Europe/Paris
IT Europe/Paris
JP Asia/Tokyo
AU Australia/Sydney
AE Asia/Dubai

操作

listProfiles

GET /v1/profiles

检索与身份验证令牌关联的配置文件。

参数

响应

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

getProfile

GET /v1/profiles/{profileId}

检索由标识符指定的单个配置文件。

参数

参数名称 类型 描述
profileId string 配置文件标识符。

响应

状态码 响应对象
200 - success Profile列表
401 - unauthorized Error
404 - profile not found Error

updateProfiles

PUT /v1/profiles

更新一个或多个配置文件。使用 profileId 对广告主进行标识。

参数

类型 指定位置 描述
Profile列表 body(体) 包含配置文件 ID 和要修改的可变字段的更新列表。 可变字段:dailyBudget

响应

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

registerProfile

PUT /v1/profiles/register

在沙盒中注册配置文件。如果对生产接口进行此调用,您将收到错误信息。

参数

类型 指定位置 描述
countryCode body(体) 您希望在其中注册配置文件的国家/地区。可以是以下值之一: US、CA、UK、DE、FR、ES、IT、JP、AU、AE

响应

状态码 响应对象
200 - Success 配置文件注册成功。
401 - Unauthorized Error
404 - Not Found Error.如果将此调用发送到生产接口,将返回该错误信息。

registerBrand

PUT /v1/profiles/registerBrand

在沙盒中注册品牌。如果对生产接口进行此调用,您将收到错误信息。

参数

类型 指定位置 描述
countryCode body(体) 您希望在其中注册配置文件的国家/地区。可以是以下值之一: US、CA、UK、DE、FR、IT、ES、JP、AU、AE
brand Body(体) REQUIRED(必需)。品牌名称。

响应

状态码 响应对象
200 - Success 配置文件注册成功。
401 - Unauthorized Error
404 - Not Found Error.如果将此调用发送到生产接口,将返回该错误信息。

资源表现

配置文件

{
    "title": "Profile",
    "type": "object",
    "properties": {
       "profileId": {
           "description": "The ID of the profile",
           "type": "number"
       },
       "countryCode": {
           "description": "The country code identifying the publisher(s) on which ads will run",
           "type": "string",
           "oneOf": ["US"]
       },
       "currencyCode": {
           "description": "The currency used for all monetary values for entities under this profile",
           "type": "string",
           "oneOf": ["USD"]
       },
       "dailyBudget": {
           "description": "The optional budget shared by all entities created under this profile",
           "type": "number",
           "minimum": 1.00
       },
       "timeZone": {
           "description": "The tz database time zone used for all date-based campaign management and reporting.",
           "type": "string"
       },
       "accountInfo": {
           "type": "object",
           "properties": {
               "marketplaceStringId": {
                   "description": "The string identifier for the marketplace associated with this profile.This is the same identifier used by MWS",
                   "type": "string"
               },
                "sellerStringId": {
                   "description": "The string identifier for the seller associated with this profile.This is the same identifier used by MWS",
                   "type": "string"
               }
           }
       }
    }
 }

ProfileResponse

 {
    "title": "ProfileResponse",
    "type": "object",
    "properties": {
       "profileId": {
           "description": "The ID of the profile that was 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"
       }
    }
}

Error

{
    "title": "Error",
    "type": "object",
    "properties": {
       "code": {
           "description": "An enumerated error code for machine use",
           "type": "string"
       },
       "details": {
           "description": "A human-readable description of the error. ",
           "type": "string"
       }
    }
}