开发人员指南概述

亚马逊广告 API 概览

维度

维度决定了报告数据的汇总级别。可用维度取决于所选的报告类型。每个维度还会自动将特定的指标添加到您的报告中。使用下表了解每种报告类型可使用的维度,以及将自动添加哪些指标。

注意

如果未指定任何维度,则“Order”为默认维度。

汇总表

| 维度 | 报告类型 | 默认指标 | |--- |--- |--- | | Order | 全部 | orderName
orderId
orderStartDate
orderEndDate
orderBudget
orderExternalId
orderCurrency | | Line_item | 全部 | lineItemName
lineItemId
lineItemStartDate
lineItemEndDate
lineItemBudget
lineItemExternalId | | Creative | Campaign
Conversion_source | creativeName
creativeID
creativeType
creativeSize
creativeAdId (not available for CONVERSION_SOURCE reports) | | 站点 | Inventory | siteName | | 库存 | Inventory | supplySourceName | | 促销 | Inventory | deal
dealID | | 国家/地区 | Geography | country | | State_country_region | Geography | region | | 城市 | Geography | city | | DMA | Geography | designatedMarketAreaCode
designatedMarketAreaName | | Postal_code | Geography | postalCode | | Operating_system | Technology | operatingSystem | | Browser_type | Technology | browser | | Browser_version | Technology | browserVersion | | Device_type | Technology | device | | 环境 | Technology | environmentType |

每个维度的默认指标

每个维度都会在您的报告数据中自动包含一些默认指标。如果您尝试在请求体的指标列表中指定这些默认指标,则会收到错误消息。

请求体中包含默认指标的错误示例

以下错误请求的报告类型为 Geography,维度为 DMA

curl --location --request POST 'https://advertising-api.amazon.com/accounts/ID123456789/dsp/reports' \
     --header 'Amazon-Advertising-API-ClientId: amzn1.application-oa2-client.xxxxxxxxxxxxx' \
     --header 'Content-Type: application/json' \
     --header 'Authorization: Bearer Atza|xxxxxxxxxxx' \
     --header 'Accept: application/vnd.dspcreatereports.v3+json' \
     --data-raw '{
         "type": "GEOGRAPHY"
         "dimensions" ["DMA"],
         "metrics": ["designatedMarketAreaCode"],
         "startDate": "2022-12-05",
         "endDate": "2022-12-19"
     }'

由于在 metrics 字段中包含了 designatedMarketAreaCode,而这是 DMA 维度的默认指标,因此 API 返回一个错误:

{
    "message": "'1' validation error(s) occurred.Please correct them and request again.",
    "requestId": "c4e391f6-cdcc-4ee1-a4df-3ff50a8f25d7",
    "errors": [
    {
        "errorType": "REQUEST_BODY_FIELD_INVALID_METRICS",
        "field": "metrics",
        "message": "Request body field 'metrics' has invalid values: [designatedMarketAreaCode]"
        }
    ]
}