创建SPU

接口描述

该接口可创建SPU及相应的SPL,SPL_ITEM, SPV和ITEM, 也可单独创建SPU后,其余信息使用对应的创建接口创建。

URL

/ark/open_api/v1/spu

Method

POST

Request Body (content-type:application/json;charset=utf8)

请务必按以下字段要求添加数据,以免系统报错。

{
    "spu":{
        "brand_id":"52d0deb1b4c4d655316b7d4b",
        "category_id":"572dd173939e250d08ec59f2",
        "name":"test1",
        "ename":"test1",
        "short_name":"test1"
    },
    "spl":{
       "variants":[
            {
                 "id": "56d84f9a805d891008705275",
                 "value": "white",
                 "value_id": "56d84f9a805d891008705666"
            }
           ]
    },
    "spl_item":{
        "image_urls":["http://img.xiaohongshu.com/items/3135edc58855dcf047fc39161ee9f687@2o.jpg"],
        "desc":"initial",
        "feature":"initial",
        "attributes":[
                        {
                             "property_id": "58450b30805d89635938325e",
                             "value_id": "56d84f9a805d891008705666",
                        },
                        {
                             "property_id": "58450b30805d89635938325f",
                             "value": "CHINA"
                        }
                    ],
        "faqs": [
                    {
                         "question": "question",
                         "answer": "answer"
                    }
                ],
        "user_guide":{
            "image_urls":["http://img.xiaohongshu.com/items/3135edc58855dcf047fc39161ee9f687@2o.jpg"]
        },
        "image_desc":{
            "image_urls":["http://img.xiaohongshu.com/items/3135edc58855dcf047fc39161ee9f687@2o.jpg"]
        }
    },
    "spv":{
            "qty": 1,
            "unit": "件",
            "net_weight": 250,
            "gross_weight": 450,
            "barcode": "test01",
            "barcode_type": "upc",
            "country": "中国",
            "shelf_life":190,
            "non_desc_variants":[
                {
                 "id": "56d84f9a805d891008705276",
                 "value": "L",
                 "value_id": "56d84f9a805d891008705666"
                }
            ],
            "import_cost":1234,
            "manufacturer": "test",
            "ingredient": "test",
            "usage": "test",
            "customs_photos_urls":["http://img.xiaohongshu.com/items/3135edc58855dcf047fc39161ee9f687@2o.jpg"],
            "customs_specification":"test specification"
    },
    "item":{
            "price": 252.69,
            "original_price": 699.0,
            "pre_tax_price": 200.0
    }


}

Request Body Parameters

名称 类型 说明
spu Dict SPU模块信息
name String SPU中文名称
ename String SPU英文名称
brand_id String 品牌ID
short_name String 商品简称(不超过15个中文字符)
category_id String 分类ID (必须是最末级分类ID)
spl Dict SPL模块信息
variants Array SPL规格列表
id String 规格ID
value String 规格值
spl_item Dict SPL ITEM模块信息
image_urls Array 商品图片URL列表
feature String 商品特色 (8字真言,不超过八个字符)
desc String 商品描述
user_guide Dict 使用指南,支持上传图片url
image_urls Array 使用指南的图片url列表
image_desc Dict 图文详情
image_urls Array 图文详情的图片url列表
attributes Array 产品参数,补充信息
property_id String 产品参数id
value String 产品参数信息
faqs Array 常见问题
question String 常见问题中的问题
answer String 常见问题中的答案
spv Dict spv模块信息
barcode String 商品条形码,只能输入“字母 数字 / -” (创建商品时手动填入,首选upc码,但不介意商家使用自定义商品编码)
barcode_type String 条码类型
non_desc_variants Array SPV规格, 无SPV规格可不填
id String SPV规格id
value String SPV规格值
net_weight Float 净重
gross_weight Float 毛重
country String 原产国
qty Int 件数,内含数量
unit String 单位
shelf_life Int 保质期(天)
import_cost Float 进口成本价(CNY)(可粗略估计)
manufacturer String 生产厂家(填写全称,中文/英文)
customs_specification String 规格型号(例如,液体:10ml,10ml/支 (等其他计量单位) ;固体:10g,10g/支 (等其他计量单位);配饰/鞋子/服装:尺寸、尺码、颜色。)
ingredient String 材质或成分含量(例如,水、二氧化碳等;帆布、牛皮等)
usage String 用途(例如,护肤等;背包、双肩包、凉鞋等)
customs_photos_urls Array 商品图片(用于海关备案)
item Dict item模块信息
original_price Float 商品原价
pre_tax_price Float 税前价,跨境税商家必填
price Float 税后价,非跨境税商家必填
value_id String 属性值id,若传入该值则value不生效,以value_id为准;若不使用属性值id请不要传入该字段。

补充说明

  1. 创建接口内的“qty”指内含数量不是库存数量

  2. 所有文描信息中请勿添加HTML标签,换行请用"\n"

  3. 使用产品参数和规格前请使用“由末级分类获取产品参数”和“由末级分类获取规格”接口得到需要填入的id。

  4. 其中attributes和faqs传入[]时会删掉已填信息。

  5. 请求中的image_urls字段为图片的url链接。

    • 商品图片 尺寸:800x800,750x1000;格式:JPG/PNG/JPEG;图片比例:1:1,3:4
    • 使用指南 尺寸:单个图片宽度为750px~1242px,高度≤1546px;
    • 商品详情 尺寸:单个图片宽度为750px~1242px,高度≤1546px;格式:JPG/PNG/JPEG;大小:每张图片容量应小于等于2M;

      请按照规则上传图片,如图片不符合要求,将不会有额外错误信息,调用接口后将无法在后台系统中看到对应图片,也无法展示在前端商详页。

  6. 属性分为销售属性和非销售属性,其中销售属性为规格(SPL规格和SPV规格)可通过【由末级分类获取规格】接口获取, 非销售属性为产品参数,可通过【由末级分类获取产品参数】接口获取。 通过【由属性获取属性值】接口获取不同属性下可使用的属性值。

Response 200 (application/json;charset=utf-8)

{
    "error_code": 0,
    "data": {
        "spvs": [
            {
                "spu_id": "58e4a96caf0a672dcda6db07",
                "pending_changes": null,
                "import_cost": 1234,
                "net_weight": 250,
                "qty": 1,
                "spl_id": "58e4a96caf0a672dcda6db08",
                "id": "58e4a96daf0a672dcda6db0b",
                "unit": "件",
                "barcode_type": "upc",
                "non_desc_variants": [
                    {
                        "ename": "Shoes Size",
                        "id": "56d84f9a805d891008705276",
                        "value": "L",
                        "name": "尺码"
                    }
                ],
                "state": 1,
                "usage": "test",
                "shelf_life": 190,
                "ingredient": "test",
                "status": 2,
                "customs_photos_urls": [
                    "http://img.xiaohongshu.com/items/3135edc58855dcf047fc39161ee9f687@2o.jpg"
                ],
                "barcode": "test01",
                "gross_weight": 450,
                "customs_photos": [],
                "manufacturer": "test",
                "customs_specification": "test specification",
                "country": "中国"
            }
        ],
        "items": [
            {
                "spu_id": "58e4a96caf0a672dcda6db07",
                "update_time": 1491380589,
                "ename": "GUCCI test1 white L",
                "name": "GUCCI古驰 test1 white L",
                "skucode": "test01",
                "original_price": 699.0,
                "tax": 52.700000000000003,   
                "pre_tax_price": 200.0,   
                "price": 252.69999999999999,   
                "tax_rate": 0.26350000000000001,
                "barcode": "test01",
                "pending_changes": null,
                "available": true,
                "buyable": false,
                "spv_id": "58e4a96daf0a672dcda6db0b",
                "state": 1,
                "create_time": 1491380589,
                "status": 1,
                "spl_id": "58e4a96caf0a672dcda6db08",
                "top_image": null,
                "id": "58e4a96daf0a672dcda6db0d",
                "barcode_type": "upc",
                "logistics": "auto"
            }
        ],
        "spls": [
            {
                "spu_id": "58e4a96caf0a672dcda6db07",
                "status": 2,
                "id": "58e4a96caf0a672dcda6db08",
                "state": 1,
                "variants": [
                    {
                        "ename": "Color",
                        "id": "56d84f9a805d891008705275",
                        "value": "white",
                        "name": "颜色"
                    }
                ],
                "pending_change": null
            }
        ],
        "spus": [
            {
                "pending_changes": null,
                "ename": "test1",
                "name": "test1",
                "short_name": "test1",
                "brand": {
                    "ename": "GUCCI",
                    "id": "52d0deb1b4c4d655316b7d4b",
                    "name": "古驰"
                },
                "brand_id": "52d0deb1b4c4d655316b7d4b",
                "category_id": "572dd173939e250d08ec59f2",
                "id": "58e4a96caf0a672dcda6db07",
                "categories": [
                    {
                        "ename": "Shoes",
                        "id": "52ce1c02b4c4d649b58b892f",
                        "name": "鞋子"
                    },
                    {
                        "ename": "Women's shoes",
                        "id": "56a6eecd8e7989cd56fcea7f",
                        "name": "女鞋"
                    },
                    {
                        "ename": "Women's high heels",
                        "id": "572dd173939e250d08ec59f2",
                        "name": "女士高跟鞋"
                    }
                ]
            }
        ],
        "spl_items": [
            {
                "spu_id": "58e4a96caf0a672dcda6db07",
                "status": 2,
                "videos": null,
                "spl_id": "58e4a96caf0a672dcda6db08",
                "feature": "initial",
                "image_urls": [
                    "http://img.xiaohongshu.com/items/3135edc58855dcf047fc39161ee9f687@2o.jpg"
                ],
                "faqs": [
                    {
                        "answer": "answer",
                        "question": "question"
                    }
                ],
                "state": 1,
                "pending_changes": {
                    "status": 0,
                    "videos": null,
                    "feature": null,
                    "faqs": null,
                    "images": [
                        {
                            "name": null,
                            "extension": ".jpg",
                            "height": 1200,
                            "width": 900,
                            "link": "http://img.xiaohongshu.com/items/d84d018842bbff888a8a132fcf445769",
                            "path": "items/d84d018842bbff888a8a132fcf445769"
                        }
                    ],
                    "attributes": null,
                    "desc": null
                },
                "user_guide": {
                    "images": [
                        {
                            "name": null,
                            "extension": ".jpg",
                            "height": 1200,
                            "width": 900,
                            "link": "//img.xiaohongshu.com/items/d84d018842bbff888a8a132fcf445769",
                            "path": "items/d84d018842bbff888a8a132fcf445769"
                        }
                    ],
                    "videos": []
                },
                "image_desc": {
                    "images": [
                        {
                            "name": null,
                            "extension": ".jpg",
                            "height": 1200,
                            "width": 900,
                            "link": "//img.xiaohongshu.com/items/d84d018842bbff888a8a132fcf445769",
                            "path": "items/d84d018842bbff888a8a132fcf445769"
                        }
                    ],
                    "image_urls": []
                },
                "images": null,
                "attributes": [
                    {
                        "ename": null,
                        "name": "材质",
                        "image": null,
                        "value": "TEST MATERIAL",
                        "image_url": null,
                        "property_id": "58450b30805d89635938325e"
                    },
                    {
                        "ename": null,
                        "name": "产地",
                        "image": null,
                        "value": "CHINA",
                        "image_url": null,
                        "property_id": "58450b30805d89635938325f"
                    }
                ],
                "id": "58e4a96caf0a672dcda6db09",
                "desc": "initial"
            }
        ]
    },
    "error_msg": null,
    "success": true
}

Response parameters

名称 类型 说明
pending_changes Array 待审核的更改信息
spus Array SPU模块信息
id String SPU ID
categories Array 分类列表,从一级分类到末级分类
spls Array SPL模块信息
id String SPV ID
spl_items Array SPL ITEM模块信息
id String SPL ID
spvs Array SPV模块信息
id String SPV ID
items Array ITEM模块信息
id String ITEM ID,商品id
available Bool true为可选择上架,false为不可选择上架
buyable Bool true为可售卖,实际上架状态, false为不可售卖,实际下架状态
top_image String 天王图
create_time Int 商品创建时间
update_time Int 最后更新时间
original_price Float 商品原价
tax Float 税金
pre_tax_price Float 税前价,跨境税商家必填
price Float 税后价,非跨境税商家必填
tax_rate Float 税率
spu_id String SPU ID
spl_id String SPL ID
spv_id String SPV ID
id String ITEM ID,商品id

补充说明

  1. state & status 具体状态码请参考商品状态码

  2. 商品的available字段标识商家可以操控的商品的上下架操作,商品的buyable字段标识商品的可售卖状态(实际的上下架状态),当商品available为true时,且其他可售卖必备的信息都满足时(图片、描述、海关备案信息等)商品的可售卖状态(buyable)自动会变成true。

  3. 规格和属性值请通过相关接口获取到value_id,如只提供value,平台会先进行属性匹配,如没有找到对应属性值,则后台属性将自动变为“其它”类型。