Add Commodity

Last Updated on : 2023-06-15 05:55:41

Add a commodity to the commodity database of the specified store.

API address

POST: /v1.0/sellercenter/commodity

Request parameter

Description of body

Parameter name Type IN Required Description
mall_code String true The code of the specified mall.
site_code String true The code of the specified country or region.
type Integer false The type of the specified commodity. Valid values:
  • 0: physical commodity.
  • 5: virtual commodity.
title String true The commodity title with up to 80 characters.
description String false The description of the specified commodity. You can enter detailed information about the commodity in this field in the rich text format (RTF), with up to 20,000 characters.
brand String false The commodity brand with up to 30 characters.
code String false The commodity code or model with up to 50 characters.
pid String false The commodity product ID (PID) with up to 16 characters. This field is obsolete.
first_category_code String false The code of the specified level-1 category.
second_category_code String false The code of the specified level-2 category.
third_category_code String false The code of the specified level-3 category.
showcase_codes List false The codes of the specified categories that are presented in the frontend.
video String false The video to show the specified commodity. When this API is used, you must upload a video URL, so the video file can be accessed by using a browser. It only supports a video in the MP4 format, no more than 50 MB. The recommended duration is 9 to 30 seconds.
video_pic String false The image to show the specified video. When this API is used, you must upload an image URL, so the image file can be accessed by using a browser. This field is required when video is not empty.
show_pictures List false The image to show the specified commodity. When this API is used, you must upload an image URL, so the image file can be accessed by using a browser. It supports up to 10 images in the JPG, PNG, or GIF format. Each image must be 500 KB or less in size, with a recommended size of 750 × 750 pixels.
detail_pictures List false The image that shows the details of a commodity. This field is obsolete. When this API is used, you must upload an image URL, so the image file can be accessed by using a browser. It supports up to 15 images in the JPG, PNG, or GIF format. Each image must be 3 MB or less in size, with a recommended size of 750 × 750 pixels.
sku_list List false The list of SKUs. Maximum value: 100.
postage_type Integer false The type of postage. This field is obsolete. Valid values:
  • 1: free shipping.
  • 2: fixed postage.
postage_fee BigDecimal false The postage fee of the specified commodity. This field is obsolete. This field is required if the value of postageType is set to 2.
install_type Integer false The installation type. This field is obsolete.
  • 1: no need to install. Default value.
  • 2: on-site installation.
  • 3: installation by users.
install_fee BigDecimal false The installation fee. This field is obsolete.
is_jump Boolean false Specifies whether to navigate to a third-party page. Valid values:
  • true: Yes.
  • false: No. Default value.
jump_link String false The navigation link of the specified commodity. This field is required if the value of isJump is set to true.
publish Boolean false Specifies whether to list the specified commodity. Valid values:
  • true: List the commodity at once. Default value.
  • false: Do not list the commodity.
sub_title String false The commodity subtitle with up to 250 characters.
multiple_options Boolean false Specifies whether the SKU has multiple specifications. Valid values:
  • true: multiple specifications.
  • false: single specification.

Description of sku_list

Parameter name Type IN Required Description
sku_pic_list List false The list of SKU images. When this API is used, you must upload an image URL, so the image file can be accessed by using a browser. It supports up to 10 images in the JPG, PNG, or GIF format. Each image must be 500 KB or less in size, with a recommended size of 750 × 750 pixels.
original_price BigDecimal false The original price of the SKU. It supports up to two decimal places. If the value is empty, it defaults to 0.
sale_price BigDecimal false The sales price of the SKU. It supports up to two decimal places. If the value is empty, it defaults to 0.
inventory Integer false The inventory. It supports an integer. If the value is empty, it defaults to 0.
weight BigDecimal false The weight in kilograms (KG). It supports up to three decimal places. If the value is empty, it defaults to 0.
external_code String false The external code.
support_out_stock_buy Boolean false Specifies whether the buyers can place an order when the inventory is zero.
sku_attr_list List false The list of SKU attributes.

Description of sku_attr_list

Parameter name Type IN Required Description
attr_code String true The code of the specified attribute.
attr_value_id Long true The ID of the specified attribute value.
attr_name String false The name of the specified attribute.
attr_value_name String false The name of the specified attribute value.

Return parameter

Parameter name Type Description
result CommodityAddOpenApiVO The returned result.

Description of result

Parameter name Type Description
commodity_code String The unique code of the specified commodity.

Request example

POST: /v1.0/sellercenter/commodity
{
  "mall_code": "8h4tiureddm***",
  "site_code": "CN",
  "type": 0,
  "title": "Refrigerator",
  "sub_title": "Hr Refrigerator X0",
  "description": "<div><p>Smart refrigerator...</p><img src='https://image-demo.oss-cn-hangzhou.aliyuncs.com/exa****.jpg' /></div>",
  "brand": "hr",
  "code": "define_code",
  "first_category_code": "12",
  "second_category_code": "1312",
  "third_category_code": "131211",
  "show_pictures": [
    "https://image-demo.oss-cn-hangzhou.aliyuncs.com/exa****.jpg"
  ],
  "video": "https://image-demo.oss-cn-hangzhou.aliyuncs.com/exa****.mp4",
  "video_pic": "https://image-demo.oss-cn-hangzhou.aliyuncs.com/exa****.jpg",
  "showcase_codes": [
    "Cbgrc6mvk***"
  ],
  "is_jump": false,
  "jump_link": "",
  "multiple_options": true,
  "publish": true,
  "sku_list": [
    {
      "sku_pic_list": [
        "https://image-demo.oss-cn-hangzhou.aliyuncs.com/exa****.jpg"
      ],
      "external_code": "",
      "inventory": 100,
      "original_price": 1,
      "sale_price": 2,
      "support_out_stock_buy": false,
      "sku_attr_list": [
        {
          "attr_code": "COLOR",
          "attr_value_id": 1001
        }
      ],
      "weight": 0
    }
  ]
}

Return example

{
    "result": {
        "commodity_code": "CMaplyr4bzck***"
    },
    "t": 1624969838836,
    "success": true
}

Error code

For more information, see error code.

Error code Error message Description
2000000 params error Parameter error.
2001000 shop does not exist The store (site) does not exist.
2000001 character limit exceeded Exceeded the character quantity limit.
2002002 commodity title already exists The commodity title already exists.
2002003 category does not exist The commodity category does not exist.
2002004 failed to add commodity Failed to add the commodity.
2002201 sku exceeds the maximum limit The number of SKUs exceeds the upper limit.
2002202 sku attribute does not exist The SKU attribute does not exist.
2002203 the sku combination rule is wrong The SKU is not combined according to the specified rules.
2004000 image size exceeds limit The size of the media file exceeds the upper limit.
2004001 the number of pictures exceeds the limit The number of images exceeds the upper limit.
2004002 picture error Image error.
2004003 video error Video file error.