主页文档代码示例API 参考公告模型发行说明常见问题GitHub视频
开发者中心API 状态支持
文档
开发者中心API 状态支持

销售 API v1 用例指南

销售 API 的用例。

API 版本:v1

什么是销售 API?

The Selling Partner API for Sales (Sales API) provides sellers with sales performance information. This is achieved through returning aggregated order metrics for a given period of time, broken down by granularity, and buyer type. Refer to the Sales API Reference for details about Sales API operations and associated data types and schemas.

先决条件

要成功完成本教程,您必须具备以下条件:

  1. Authorization from the selling partner for whom you are making calls. Refer to Authorizing Selling Partner API applications for more information.
  2. The Pricing role assigned to your developer profile.
  3. The Pricing role selected in the App registration page for your application.

教程:接收销售业绩信息

本节将引导您完成使用销售 API 接收销售业绩信息的过程。

获取销售业绩信息

Call the getOrderMetrics operation with the following parameters to receive aggregated order metrics for a given interval:

查询参数:

参数 描述 必填项
marketplaceIds

商城标识符。指定下订单的商城。只能指定一个商城。

例如,ATVPDKIKX0DER 表示美国商城。

类型:< 字符串 > 数组

有帮助
interval

A time interval used for selecting order metrics. This takes the form of two dates separated by two hyphens (first date is inclusive; second date is exclusive). Dates are in ISO 8601 format and must represent absolute time (either Z notation or offset notation).

示例:2018-09-01T00:00:00-07:00--2018-09-04T00:00:00-07:00 请求 9 月 1 日、2 日和 3 日 -07:00 区的订单指标。

类型:字符串

有帮助
granularityTimeZone

与 IANA 兼容的时区,用于确定日边界。当指定的粒度值大于“小时”时,必须使用。granularityTimeZone 值必须与指定间隔值的偏移量一致。例如,如果时间间隔值使用 Z 表示法,则 granularityTimeZone 必须是 UTC。如果间隔值使用偏移量,则 granularityTimeZone 必须是与偏移量相匹配的 IANA 兼容时区。

示例:US/Pacific 用于计算美国/太平洋地区的日界,并考虑夏令时。

类型:字符串

没有帮助
granularity

订单指标分组的 granularity,基于时间单位。只有当指定的时间间隔小于或等于 30 天时,指定 granularity=Hour 才能使请求成功。对于所有其他粒度,指定的间隔必须小于或等于 2 年后。指定 granularity=Total 的结果是在您指定的整个时间间隔内汇总的订单指标。如果间隔的开始和结束日期与指定的 granularity 不一致,则响应间隔的头端和尾端将包含部分数据。

示例:获取请求间隔每日细分的日期,其中日界由 granularityTimeZone 定义。

Type: enum (Granularity)

有帮助
buyerType

按您指定的买家类型筛选结果,B2B(企业对企业)或 B2C(企业对消费者)。

示例:B2B,如果您希望响应仅包含 B2B 买家的订单指标。

Type: enum (BuyerType)

没有帮助
fulfillmentNetwork

按您指定的配送网络筛选结果,MFN(卖家配送网络)或 AFN(亚马逊物流)。如果您希望响应中包括所有配送网络的订单指标,请不要包含此筛选条件。

示例:AFN,如果您希望响应中仅包括亚马逊物流的订单指标。

类型:字符串

没有帮助
firstDayOfWeek

指定一周开始的那一天 granularity=WeekMondaySunday。默认:Monday

示例:Sunday,如果您想让一周从星期日开始。

Type: enum (FirstDayOfWeek)

没有帮助
asin

按您指定的 ASIN 筛选结果。同时指定 asinsku 会返回错误。如果您希望响应中包含所有 ASIN 的订单指标,请不要包括此筛选条件。

示例:B0792R1RSN,如果您希望响应仅包括 asin B0792R1RSN 的订单指标。

类型:字符串

没有帮助
sku

按您指定的 SKU 筛选结果。同时指定 asinsku 会返回错误。如果您希望响应中包括所有 SKU 的订单指标,请不要包括此筛选条件。

示例:TestSKU,如果您希望响应中仅包括 SKU TestSKU 的订单指标。

类型:字符串

没有帮助

请求示例

GET https://sellingpartnerapi-na.amazon.com/sales/v1/orderMetrics?marketplaceIds=&interval=&granularityTimeZone=&granularity=&buyerType=&fulfillmentNetwork=&firstDayOfWeek=&asin=&sku="

响应

参数 描述 必填项
interval

基于请求粒度的时间间隔(例如小时、日等)。如果这是列表中的第一个或最后一个间隔,则当请求的时间间隔与请求的粒度不一致时,可能会包含不完整的数据

(例如,请求间隔 2018-09-01T02:00:00Z--2018-09-04T19:00:00Z 而粒度“日”将导致“Sept 1st UTC day”和“Sept 4th UTC days”返回部分数据)。

类型:字符串

有帮助
unitCount

基于指定筛选条件的订单中的商品数量。

类型:整数

有帮助
orderItemCount

基于指定筛选条件的订单商品数量。

类型:整数

有帮助
orderCount 基于指定筛选条件的订单数量。

类型:整数

有帮助
averageUnitPrice 基于指定筛选条件的商品的平均价格。公式为“销售总额/单位数”。

Type: Money

有帮助
totalSales 基于指定筛选条件的所有订单的总已订购商品销售额。

Type: Money

有帮助

响应示例

{ "request": { "parameters": { "granularity": { "value": "Day" } } }, "response": { "payload": [ { "interval": "2019-08-01T00:00-07:00--2018-08-02T00:00-07:00", "unitCount": 1, "orderItemCount": 1, "orderCount": 1, "averageUnitPrice": { "amount": "22.95", "currencyCode": "USD" }, "totalSales": { "amount": "22.95", "currencyCode": "USD" } }, { "interval": "2019-08-02T00:00-07:00--2018-08-03T00:00-07:00", "unitCount": 1, "orderItemCount": 1, "orderCount": 1, "averageUnitPrice": { "amount": "2.05", "currencyCode": "USD" }, "totalSales": { "amount": "2.05", "currencyCode": "USD" } } ] } }

此页面对您有帮助吗?