Logo
    立即注册
    开放平台
    产品文档
    趋势销售数据汇总
    最近更新时间:2023-08-09 17:45:17

    1. 接口描述

    接口URL:https://open.datastory.com.cn/api/datastory.ecommerce.item.trend.metric 请求方式:POST 描述:通过该接口可查看趋势销售数据详情,具体输出内容可查看输出参数示例。

    2. 输入参数

    以下请求参数列表仅列出了接口请求参数和部分公共参数,完整公共参数列表见公共请求参数。

    参数名称 必选 默认值 类型 参数示例 描述
    appkey string "predeploy" 权限校验标识
    filters Array of RequestltemFilters (见接口示例) 查询过滤条件
    metrics Array of RequestBaseMetrics (见接口示例) 查询过滤条件
    openStrategy boolean false 是否接受缓存
    page integer 1 分页查询的页码,默认1
    pageSize integer 20 分页查询的单页数据条数,默认20

    3. 输出参数

    参数名称 必选 类型 参数示例 描述
    code integer 0 返回状态码,内部定义
    data Array of ResponseDataOfCommentMetric (见接口示例) 查询过滤条件
    msg string "接口返回成功!" 接口返回信息说明,在接口返回失败时会有
    openStrategy boolean false 是否接受缓存
    success boolean true 接口返回是否成功

    4. 数据结构

    4.1 RequestTrendMetricsFilters

    参数名 必选 类型 参数示例 描述
    brandName string "小米" 品牌名
    spCategoryNames string ["3c数码","美妆个护"] 品类数组,用于 支持筛选行业(仅支持品牌汇总接口)
    crawlerDate array {"end":1635695999000,"start":1627747200000} 商品爬取时间。注:默认最近一年的时间,允许缺失时间值,如2021-6月~2022-5月
    siteId integer 5 站点ID,天猫:10,京东:5
    trendName string "修护" 趋势名数组
    trendType string "人群" 趋势类型
    trendTypes array ["人群"] 趋势类型数组
    leoExpression string {\"1##name\": [\"{EXP}\", \"无糖\"],\"2##type\": [\"{EXP}\", \"成分/原料/材质\"]} leo表达式,现在支持趋势类型、名称的筛选
    boolExpression string 1 AND 2 辅助leo表达式的布尔逻辑

    4.2 RequestTrendMetrics

    参数名 必选 类型 参数示例 描述
    categoryLevel integer 5 品类聚合的层级粒度,范围1—5,5代表最末级,默认5
    dimensions array [ "siteName", "date" ] agg查询维度字段,用于查询数据分布、趋势(例如基于品牌),仅支持开放的字段:categoryName(品类)、brandName(品牌)、commodityName(产品)、siteName(站点)、skuId(商品)、date(采集时间)、trendName(趋势)、trendType(趋势类型),非法参数会报错
    filterOtherCategoryLevel boolean true 是否过滤其他品类层级
    interval string "month" 发表时间agg查询时间单位,默认:month,仅支持:day、week、month、quarter,
    非法参数会报错(目前仅支持month)
    order string "desc" 排序方式:asc(升序)、desc(降序),非法参数会报错
    sort string "monthSaleCnt" 排序字段:monthSaleCnt(自然月销量)、monthSaleAmount(自然月销售额)、date(时间)、monthSaleCntRateLp(销量环比)、monthSaleAmountRateLp(销售额环比)、itemCnt(商品数),非法参数会报错

    4.3 ResponseDataOfTrendltemMetric

    参数名 必选 类型 参数示例 描述
    dataset array [Array of ItemMetric,Array of ItemMetric] (见接口请求示例) 返回数据集,不同接口返回结果的格式不一样
    meta array "list" 返回数据格式:list、aggregation、graph
    page integer 1 分页查询的页码
    pageSize integer "20" 分页查询的单页数据条数
    time integer "955" 查询总耗时,单位毫秒
    total integer "34500230" 查询数据总量

    4.3.1 TrendItemMetricVO

    参数名 必选 类型 参数示例 描述
    brandName string "苹果" 品牌名称
    commodityId integer "32" 标品id
    commodityName string "小米 Redmi 10X 4G" 标品名称
    fifthCategoryId string "899" 五级品类Id
    fifthCategoryName string "口红其他" 五级品类名称
    firstCategoryId string "899" 一级品类id
    firstCategoryName string "洗发水" 一级品类名称
    fourthCategoryId string "899" 四级品类id
    fourthCategoryName string "洗发水" 四级品类名称
    itemCnt integer "502" 电商商品数
    itemId string "637338326057" 商品itemId
    maxSalePrice number "899.66" 自然月售价最大值
    minSalePrice number "899.66" 自然月售价最小值
    metricDate string "2022-01" 汇总时间,格式化为月
    monthSaleAmount number "89900.85" 自然月销售额
    monthSaleAmountRateLp number "0.02482" 自然月销额环比
    monthSaleCnt integer "899" 自然月销量
    monthSaleCntRateLp number "0.02482" 自然月销量环比
    monthSalePrice number "899.66" 自然月售价
    perPieceSalePrice number "899.66" 件均价(平均每件售价)
    secondCategoryId string "899" 二级品类id
    secondCategoryName string "洗发水" 二级品类名称
    siteId integer "10" 站点id
    siteName string "天猫" 站点名称
    skuId long "526498885740" 商品SkuId
    thirdCategoryName string "洗发水" 三级品类名称
    title string "iPad保护套2020第8代10.2寸2019苹果air3平板mini5软壳air2皮套6/4/2硅胶pro10.5防摔9.7版网红2018新款七八7" 商品标题
    trendName string "修护" 趋势名数组
    trendType string "人群" 趋势类型

    5. 示例

    输入示例

    {
      "appkey": "predeploy",
      "filters": {
        "crawlerDate": {
          "end": 1668503100000,
          "start": 1640966400000
        },
        "printLog": true,
        "siteId": 10,
        "spCategoryNames": [
          "3C数码",
          "美妆个护"
        ],
        "trendNames": [
          "修护"
        ]
      },
      "metrics": {
        "categoryLevel": 5,
        "dimensions": [
          "date",
          "siteName"
        ],
        "filterOtherCategoryLevel": true,
        "interval": "month",
        "order": "desc",
        "sort": "date"
      },
      "openStrategy": false,
      "page": 1,
      "pageSize": 20
    }

    输出示例

    {
      "success": true,
      "openStrategy": false,
      "code": 0,
      "msg": "接口返回成功!",
      "data": {
        "meta": {
          "datasetType": "list"
        },
        "dataset": [
          {
            "siteId": 10,
            "siteName": "天猫",
            "metricDate": "2022-10",
            "monthSalePrice": 242.8716,
            "monthSaleCnt": 10735827,
            "monthSaleAmount": 2872533278.8638,
            "perPieceSalePrice": 267.5652,
            "maxSalePrice": 17000,
            "minSalePrice": 1.1,
            "monthSaleCntRateLp": 0.4821,
            "monthSaleAmountRateLp": 1.3283,
            "itemCnt": 41379
          },
          {
            "siteId": 10,
            "siteName": "天猫",
            "metricDate": "2022-09",
            "monthSalePrice": 243.3684,
            "monthSaleCnt": 7243578,
            "monthSaleAmount": 1233743422.894,
            "perPieceSalePrice": 170.3224,
            "maxSalePrice": 44990,
            "minSalePrice": 1.1,
            "monthSaleCntRateLp": 2.5165,
            "monthSaleAmountRateLp": 2.0118,
            "itemCnt": 40968
          },
          {
            "siteId": 10,
            "siteName": "天猫",
            "metricDate": "2022-08",
            "monthSalePrice": 260.2417,
            "monthSaleCnt": 2059889,
            "monthSaleAmount": 409626451.0417,
            "perPieceSalePrice": 198.8585,
            "maxSalePrice": 44990,
            "minSalePrice": 1.15,
            "monthSaleCntRateLp": -0.5697,
            "monthSaleAmountRateLp": -0.556,
            "itemCnt": 30629
          },
          {
            "siteId": 10,
            "siteName": "天猫",
            "metricDate": "2022-07",
            "monthSalePrice": 256.9328,
            "monthSaleCnt": 4786868,
            "monthSaleAmount": 922697306.9306,
            "perPieceSalePrice": 192.756,
            "maxSalePrice": 19200,
            "minSalePrice": 1.15,
            "monthSaleCntRateLp": -0.4984,
            "monthSaleAmountRateLp": -0.6232,
            "itemCnt": 30927
          },
          {
            "siteId": 10,
            "siteName": "天猫",
            "metricDate": "2022-06",
            "monthSalePrice": 238.9538,
            "monthSaleCnt": 9543663,
            "monthSaleAmount": 2448935494.0088,
            "perPieceSalePrice": 256.6033,
            "maxSalePrice": 18700,
            "minSalePrice": 1.15,
            "monthSaleCntRateLp": 0.0786,
            "monthSaleAmountRateLp": 0.0545,
            "itemCnt": 36277
          },
          {
            "siteId": 10,
            "siteName": "天猫",
            "metricDate": "2022-05",
            "monthSalePrice": 227.592,
            "monthSaleCnt": 8848276,
            "monthSaleAmount": 2322278624.9703,
            "perPieceSalePrice": 262.4555,
            "maxSalePrice": 17000,
            "minSalePrice": 1.1,
            "monthSaleCntRateLp": 0.616,
            "monthSaleAmountRateLp": 1.44,
            "itemCnt": 39551
          },
          {
            "siteId": 10,
            "siteName": "天猫",
            "metricDate": "2022-04",
            "monthSalePrice": 236.6559,
            "monthSaleCnt": 5473358,
            "monthSaleAmount": 951735671.6035,
            "perPieceSalePrice": 173.8851,
            "maxSalePrice": 37223.3333,
            "minSalePrice": 1.15,
            "monthSaleCntRateLp": -0.3138,
            "monthSaleAmountRateLp": -0.4246,
            "itemCnt": 45262
          },
          {
            "siteId": 10,
            "siteName": "天猫",
            "metricDate": "2022-03",
            "monthSalePrice": 237.1927,
            "monthSaleCnt": 7976086,
            "monthSaleAmount": 1654135072.1299,
            "perPieceSalePrice": 207.3868,
            "maxSalePrice": 37223.3333,
            "minSalePrice": 1.15,
            "monthSaleCntRateLp": 0.3497,
            "monthSaleAmountRateLp": 0.3878,
            "itemCnt": 42424
          },
          {
            "siteId": 10,
            "siteName": "天猫",
            "metricDate": "2022-02",
            "monthSalePrice": 262.5214,
            "monthSaleCnt": 5914302,
            "monthSaleAmount": 1192164174.7026,
            "perPieceSalePrice": 201.5731,
            "maxSalePrice": 17000,
            "minSalePrice": 1.2,
            "monthSaleCntRateLp": 0.08,
            "monthSaleAmountRateLp": 0.0024,
            "itemCnt": 22201
          }
        ],
        "pageSize": 20,
        "page": 1,
        "total": 9,
        "time": 794
      }
    }

    6. 状态码

    以下仅列出了接口业务逻辑相关的状态码。

    状态码 描述

    微信扫描二维码在线咨询