# Adding goods

Note: There are 2 copies of data for the item, draft and online After calling the interface to add and modify product data, only the draft data affects it. It must be called onto the shelving interface and approved before the draft data covers the online data officially enters into force.

# Dxplaination of Interface Call Request

http请求方式:POST
https://api.weixin.qq.com/product/spu/add?access_token=xxxxxxxxx

# Example of request parameters

{
    "out_product_id": "1234566",
    "title": "任天堂 Nintendo Switch 国行续航增强版 NS家用体感游戏机掌机 便携掌上游戏机 红蓝主机",
    "sub_title": "JD自营更放心】【国行Switch,更安心的保修服务,更快的国行服务器】一台主机三种模式,游戏掌机,随时随地,一起趣玩。",
    "head_img": 
    [
        "https://store.mp.video.tencent-cloud.com/161/20304/snscosdownload/SZ/reserved/6059ade300096eb200000000f19f9d09000000a000004f50"
    ],
    "desc_info": 
    {
        "imgs": 
        [
            "https://store.mp.video.tencent-cloud.com/161/20304/snscosdownload/SZ/reserved/6059ade300096eb200000000f19f9d09000000a000004f50"
        ]
    },
    "brand_id": 2100000000,
    "cats": 
    [
        {
            "cat_id": 6033,
            "level": 1
        },
        {
            "cat_id": 6057,
            "level": 2
        },
        {
            "cat_id": 6091,
            "level": 3
        }
    ],
    "attrs": 
    [
        {
            "attr_key": "商品毛重",
            "attr_value": "380g"
        },
        {
            "attr_key": "商品产地",
            "attr_value": "中国大陆"
        }
    ],
    "model": "国行续航增强版",
    "express_info": 
    {
        "template_id": 5189
    },
    "skus":
    [
        {
            "out_product_id": "1234566",
            "out_sku_id": "1024",
            "thumb_img": "https://store.mp.video.tencent-cloud.com/161/20304/snscosdownload/SZ/reserved/6059ade300096eb200000000f19f9d09000000a000004f50",
            "sale_price": 1300,
            "market_price": 1500,
            "stock_num": 100,
            "sku_code": "A24525252",
            "barcode": "13251454",
            "sku_attrs": 
            [
                {
                    "attr_key": "选择颜色",
                    "attr_value": "红蓝主机"
                },
                {
                    "attr_key": "选择套装",
                    "attr_value": "主机+保护套"
                }
            ]
        }
    ] 
}

# Examples of back-up

{
    "errcode": 0,
    "errmsg":"ok",
    "data": 
    {
        "product_id": 23423523452345235,
        "out_product_id": "1234566",
        "create_time": "2020-03-25 12:05:25"
    }
}

# Dxplaination of request parameters

参数 type Is it compulsory? Introductions
out_product_id string yes Merchant custom product ID, and product_id two choices, need to ensure that the single AppID unique, once added after the success of the field can not be modified, up to 32 characters
title string yes Title, at least 3 characters, maximum 60 characters. Note: 1. The product title only allows Chinese characters, numbers, English letters, special character set; 2. The title of the product shall not be limited to numbers, letters, special character sets, or a combination of these.
sub_title string no Subtitle, maximum 18 characters
head_img string array yes Main images, multiple images, list, up to 9 images
desc_info.imgs string array no Item Details, Graphic Images (Currently only images are supported, up to 20)
brand_id number yes Brand ID, the business needs to apply for the brand and get the brand interface brand / get, if there is no brand, please fill in 2100000000
cats[].cat_id number yes Category ID, if brand_id = 2100000000, you need to get the available cat_id by getting the category interface category / get first;If brand_id!= 2100000000, cat_id here needs to have a one-to-one correspondence with the level 1,2,3 in the brand interface brand get
cats[].level number yes Category hierarchy
attrs[].attr_key string yes Property key (for property customization)
attrs[].attr_value string yes Attribute values (for attribute customization)
model string no Product Model
express_info.template_id number yes Shipping Template ID (first through the get shipping template interface delivery / get_freight_template)
express_info.weight number no Weight of goods, freight model pricing is required when [by weight]
skus[] array no This skus list is not required and can be added separately via BatchAddSKU
skus[].out_product_id string Skus is not empty time required Merchant custom product ID, up to 32 characters
skus[].out_sku_id string Skus is not empty time required Merchant custom skuID, up to 32 characters
skus[].thumb_img string no SCU diagram
skus[].sale_price number Skus is not empty time required Selling price, divided into units, not exceeding 1000000000 (10 million yuan)
skus[].market_price number no The market price, in units not exceeding 1000000000 ($10 million), must be greater thansale_price []
skus[].stock_num number Skus is not empty time required stock
skus[].barcode string no barcode
skus[].sku_code string no Product code, up to 20 characters
skus[].sku_attrs[].attr_key string Skus is not empty time required Property key (for property customization), up to 40 characters
skus[].sku_attrs[].attr_value string Skus is not empty time required Attribute value (attribute custom use), up to 40 characters, the same key can not be more than 100 different values.
product_type number no 1- physical commodities 2- stock code commodities. It is not implicitly considered a physical product.
couponcode_info.verify_type number Cancelled goods must be filled in 0 - You can write off every day. 1 - Holidays are not available. This field is only used as a display on the write-off page and does not limit the write-offs process. It is up to the merchant to decide whether to write off.
couponcode_info.valid_info.valid_type number Cancelled goods must be filled in 1- Effective for specified time interval 2- Effective for specified days (valid for N days after purchase)
couponcode_info.valid_info.valid_day_num number The specified number of days to take effect must be filled in Valid_type is required for 2 hours, the effective days of writing off the goods, calculated from the completion of the order payment, automatically rounded to the end of the day 23595959. The minimum value is 1 and the maximum value is 365.
couponcode_info.valid_info.start_time number Required completion for designated periods to take effect Valid_type is required at 1: 00, the date on which the write-off of the goods becomes effective. The actual effective date of the product's entry into force is automatically corrected to 00: 00: 00 that day according to the time stamp entered by that parameter.
couponcode_info.valid_info.end_time number Required completion for designated periods to take effect Valid_type is required at 1: 00, the date of expiry of the write-off product. The actual failure time of the product is automatically corrected to 23: 59: 59 on the day based on the timestamp entered by this parameter. The maximum value acceptable is the timestamp of the calling interface + 365 days.

# Be careful

  • Image-related parameters (e.g. [[]]head_imgdesc_info.imgsskus[].thumb_imgPlease use the https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent/API/register/uploadimg.html interface to upload the image (parameterresp_type = 1),The returnedtemp_img_urlshould be filled in here, where does not accept any external image url .Ifurlhas made a conversion (domain namestore.mp. video.tencent-cloud.com, or url prefixed withmmbizurl.cn / p /, or url prefixmmecimage.cn / p /),Then it may be submitted directly.
  • Characters: 1 Chinese text / 1 English letter, each counts 1 character
  • The productproduct_typemust be set when adding the product, and updating the product after that does not support modifyingproduct_type
  • The special character set allowed for item titles is

`·~~!@#$%^&()!@#¥%……&*()-_——=+[]\【】、{}||;';’:": ‘“”,./,。、<>?《》?\u00A0\u0020\u3000

  • Examples of product title compliance:

Sweet & Vinegar Pork [Book Price 10 Yuan]``CheddarCheese``Century Mountain Natural Mineral Water 1L * 15 Bottles

  • Examples of non-compliant product titles:

Authentic Wuzhi Peach root √``Classic Whole Wheat``The third generation of portable folding fan``iPhone 13``Mac999!

# Dxplaination of callback parameters

参数 type Introductions
errcode number Error code
errmsg string Error message
data.product_id number Trade Component Internal Product ID
data.out_product_id string Merchant Custom Item ID
data.create_time string Created time

# Return code

返回码 Error Type
-1 System exceptions
-2 Token too long
9401001 SPU already exists
9401002 SPU does not exist
9401020 The parameter is incorrect.
9401021 Call the api without permission
9401023 SPU does not allow editing
9401026 The category length of the goods is not correct (it is expected that there are three levels of category)
9401032 Categories Illegal
9401033 The merchant does not have the current category qualifications
9401034 Freight template idexpress_info.template_idIllegal
9401076 The current shipping model is priced in [by weight], but the submitted goods weigh 0
9401035 Product titletitleis empty
9401036 Product titletitlecharacters too long
9401037 Product master charthead_imgis empty
9401038 Product master charthead_imgToo many
9401039 Subtitlesub_titlecharacters too long
9401040 Product details picturedesc_info. img s
9401041 Item Details Description Characters are too long
9401042 Too many qualified pictures
9401043 SKU is overpriced
9401044 SKU trade codesku_codeis too long
9401045 SKU sales attributes are too long
9401046 SKU with too many key attributes
9401047 Sku attribute keyskus [].sku_attrs [].attr_keyToo long character
9401048 Sku attribute valueskus [].sku_attrs [].attr_valueCharacter too long
9401049 Aftersales instructions are too long
9401050 The image url is illegal: it is an empty character string, or the domain name is not store.mp. video.tencent-cloud.com, or URL prefix other thanmmbizurl.cn / p /, or url prefix notmmecimage.cn / p /(Please refer to the document's [Note]
9401051 Out_product_idtoo long
9401052 Out_sku_idtoo long
9401054 Sku price is 0
9401055 Sku sale pricesale_pricegreater than or equal to market pricemarket_price
9401057 Product titletitlecharacters too short
9401060 The title of the product must not be just numbers, letters, characters, and must not contain illegal characters. Please revise it after you modify it and resubmit it for review
9401063 The item's brand ID is illegal. The merchant needs to apply for a brand and obtain it via the Get Brand Interfacebrand / get. If it is unbranded please fill in210,000,000
110111 Write-off informationcouponcode_infoincomplete or incorrect
110112 The validity period for write-off goods exceeds the limit