# Add SKU

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/sku/add?access_token=xxxxxxxxx

# Example of request parameters

{
       "product_id": 23423523452345235,
       "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": 
        {
            "sku_id":2342523452352345,
            "create_time": "2020-03-25 12:05:25"
        }
}

# Dxplaination of request parameters

参数 type Is it compulsory? Introductions
product_id number no Mini Store internal product ID, and out_product_id two choice
out_product_id string no Choose between product_id and product_id
out_sku_id string yes Merchant custom sku_id, need to ensure their own single AppID unique, once added after the success of the field can not be modified, up to 32 characters
thumb_img string no SCU diagram
sale_price number yes Selling price, divided into units, not exceeding 1000000000 (10 million yuan)
market_price number no The market price, in units not exceeding 1000000000 ($10 million), must be greater thansale_price []
stock_num number yes stock
barcode string no barcode
sku_code string no Product code, up to 20 characters
sku_attrs[].attr_key string yes Property key (for property customization), up to 40 characters
sku_attrs[].attr_value string yes Attribute value (attribute custom use), up to 40 characters, the same key can not be more than 100 different values.

# Be careful

  • Picture-related parameters such asthumb_imgPlease Be sure to to use the https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent/API/register/uploadimg.html interface to upload images (parametersresp_type=1),The returnedtemp_img_urlshould be filled in here, where does not accept any external image url .Ifurlhas ever been converted (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

# Dxplaination of callback parameters

参数 type Introductions
errcode number Error code
errmsg string Error message
data.sku_id number Trading component internal skuID
data.create_time string Created time

# Return code

返回码 Error Type
-1 System exceptions
-2 Token too long
9401020 The parameter is incorrect.
9401006 SKU does not exist
9401005 SKU already exists
9401025 SKU does not allow editing
9401043 SKU is overpriced
9401044 SKU trade codesku_codeis too long
9401045
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
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]
9401052 Out_sku_idtoo long
9401054 Sku price is 0
9401055 Sku sale pricesale_pricegreater than or equal to market pricemarket_price