# Add goods

Note: Product has 2 copies of data, draft and online data Call the interface to add and modify the product data, the impact is only draft data, to tune the interface and audit, draft data will cover online data officially effective

# Interface call request specification

Http request method: POST
https://api.weixin.qq.com/product/spu/add?access_token=xxxxxxxxx

# Request Parameter Sample

{
    "out_product_id": "1234566",
    "title": " Nintendo Nintendo Switch China Line Endurance Enhanced Edition NS Home Gaming Console Portable handheld game consoles Red and blue host " ,
    "sub_title": " JD self more assured] [National Bank Switch, more secure warranty services, faster national bank server] a host three modes, game palm, anytime, anywhere, fun to play together. " ,
    "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": "Gross weight of merchandise," 
            "attr_value": "380g"
        },
        {
            "attr_key": "origin of commodities";
            "attr_value": "Mainland China"
        }
    ],
    "model": "china bank extended endurance edition";
    "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_in a": 100,
            "sku_code": "A24525252",
            "barcode": "13251454",
            "sku_attrs": 
            [
                {
                    "attr_key": "Choose color,"
                    "attr_value": "Red and blue mainframe."
                },
                {
                    "attr_key": "Choose a set";
                    "attr_value": "Host + Cover"
                }
            ]
        }
    ] 
}

# Return Package Example

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

# Request Parameter Dxplaination

parameter type Required Required Introductions
out_product_id string yes Merchant custom product ID, with product_Id two choose one, need to ensure the only single appid, once added after the success of the field can not be modified, up to 32 characters
title string yes Title, up to 60 characters
sub_title string no Subtitles, up to 18 characters
head_img string array yes Master, Multiple, List, Up to 9
desc_info.imgs string array no Product details, graphic(Currently only supports pictures, up to 20)
brand_id number yes Brand ID, merchants need to apply for the brand and get the brand interface brand/Get get, if no brand please fill 2100000000
cats[].cat_id number yes Category ID, if brand_Id = 2100000000, you first need to get the category interface category/Get available cat_idIf brand_id! = 2100000000, then the cat here_ID needs to interface with get brand brand/Get 1, 2, 3 level categories one-to-one correspondence
cats[].level number yes Category level
attrs[].attr_key string yes Attribute key (for attribute customization)
attrs[].attr_value string yes Property values (for property customization)
model string no Commodity model
express_info.template_id number yes Shipping template ID first by getting the shipping template interface delivery/get_freight_Template (get)
skus[] array no this skus The list is not required, but can be completed by BatchAddSKU Add to SKU
skus[].out_product_id string Skus is not empty Required Merchant custom product ID, up to 32 characters
skus[].out_sku_id string Skus is not empty Required Merchant custom skuID, up to 32 characters
skus[].thumb_img string no sku small diagram
skus[].sale_price number Skus is not empty Required Sale price, to be divided into units, not more than 10 million (10 million yuan)
skus[].market_price number Skus is not empty Required Market price, divided into units, not exceeding 10 million (10 million yuan)
skus[].stock_A number Skus is not empty 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 Required Attribute key (for attribute customization), up to 40 characters
skus[].sku_attrs[].attr_value string Skus is not empty Required Attribute values (for custom attributes), up to 40 characters, no more than 100 different values under the same key.
product_type number no 1 - Physical goods 2 - Coupon code goods. Do not fill default to physical goods.
couponcode_info.verify_type number Written-off goods required 0 - Daily write-off 1 - Not available for holidays. This field is only used for display on the verification page and will not limit the verification process. It is up to the merchant to decide whether to write off.
couponcode_info.valid_info.valid_type number Written-off goods required 1 - Specified time interval takes effect 2 - Specified days effective (N days after purchase)
couponcode_info.valid_info.valid_day_A number The specified number of days is required to take effect valid_When type is 2, it must be filled in. The valid days of the goods will be calculated from the completion of the order payment, and will automatically be rounded to the end day 23: 59: 59. The minimum is 1 and the maximum is 365.
couponcode_info.valid_info.start_time number Specified interval valid Required valid_Required when type is 1. Date on which the goods will become effective. The actual effective time of the item is automatically rounded to 00: 00: 00hrs on the day according to the time stamp passed in by this parameter.
couponcode_info.valid_info.end_time number Specified interval valid Required valid_When type is 1, it must be filled in, the date of expiration of the goods after verification. The actual expiration time of the product is automatically rounded to 23: 59: 59 on the day according to the time stamp passed in this parameter. The maximum acceptable value is the timestamp of the calling interface + 365 days.

# Be careful

  • Image - related parameters such ashead_imgdesc_info.imgsskus[].thumb_imgBe sure to use https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent/API/register/uploadimg.html Interface to upload pictures (parametersor_type=1And returns thetemp_img_urlFill in here, here.Do not accept any external link image urlIfurlHas done a conversion (domain name isstore.mp.video.tencent-cloud.comOr the url prefix ismmbizurl.cn/p/Or the url prefix ismmecimage.cn/p/You can submit directly.
  • Character: 1 Chinese character/1 letter, each count as 1 character
  • productproduct_typeMust be set at the time of adding a product, then updating the product does not support modificationproduct_type

# Return parameter specification

parameter type Introductions
Errcode number Error code
errmsg string Error message
data.product_id number Internal Product ID of Transaction Component
data.out_product_id string Custom Product ID
data.create_time string Time of creation

# Return code

Return code Type of error
-1 System exception
-2 Token is too long
9401001 SPU already exists
9401002 SPU does not exist
9401020 Wrong parameter
9401021 Call the api without permission
9401023 SPU does not allow editing
9401026 The item category length is not correct (expected to have three categories)
9401032 Category illegal
9401033 The merchant does not have the current category qualification
9401034 Shipping Template IDexpress_info.template_idillegal
9401035 Product TitletitleEmpty
9401036 Product TitletitleCharacters too long
9401037 Product master charthead_imgEmpty
9401038 Product master charthead_imgtoo much
9401039 subheadingsub_titleCharacters too long
9401040 Picture of the daydesc_info.imgstoo much
9401041 Product details description characters too long
9401042 Too many pictures
9401043 SKU overpriced
9401044 SKU Product Codesku_codeToo long
9401045
9401046 Too many SKUs with key attributes
9401047 Key Property Keyskus[].sku_attrs[].attr_keyCharacters too long
9401048 Sku attribute valueskus[].sku_attrs[].attr_valueCharacters too long
9401049 After-sales explaination characters too long
9401050 Image url illegal: empty string, or domain name is notstore.mp.video.tencent-cloud.comOr the url prefix is notmmbizurl.cn/p/Or the url prefix is notmmecimage.cn/p/(Refer to [Notes] in the documentation)
9401051 out_product_idToo long
9401052 out_sku_idToo long
110111 Write-off informationcouponcode_infoIncomplete or wrong
110112 The validity period of the goods written off exceeds the limit