Edit Commodity

Last Updated on : 2024-01-12 02:43:01download

Edit a commodity in the commodity database of the specified store.

API address

POST: /v1.0/cloud/ecm/store/admin/api/commodity/edit

Request parameter

Description of body

Parameter nameTypeINRequiredDescription
mall_codeString trueThe code of the specified mall.
site_codeString trueThe code of the specified site.
commodity_codeString trueThe code of a specified commodity. Required.
titleString falseThe commodity title with up to 80 characters.
sub_titleString falseThe commodity subtitle with up to 250 characters.
descriptionString falseThe commodity description with up to 20,000 characters. Support rich text.
brandString falseThe commodity brand with up to 30 characters.
first_category_codeString falseThe code of the level-1 category.
second_category_codeString falseThe code of the level-2 category.
third_category_codeString falseThe code of the level-3 category.
showcase_codesList falseThe codes of the specified categories that are presented in the frontend.
videoString falseThe 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_picString falseThe 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_picturesList falseThe 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 file must be 500 KB or less in size, with a recommended size of 750 × 750 pixels.
is_jumpBoolean falseSpecifies whether to navigate to a third-party page. Valid values:
  • true: Yes.
  • false: No. Default value.
jump_linkString falseThe navigation link of the specified commodity. This field is required if the value of is_jump is set to true.
publishBoolean falseSpecifies whether to list the specified commodity. Valid values:
  • true: List the commodity at once. Default value.
  • false: Do not list the commodity.
sku_listList falseThe list of SKUs. Maximum value: 100.

Description of sku_list

Parameter nameTypeINRequiredDescription
skuCodeString falseThe unique code of the specified SKU. This field is required when you modify an existing SKU.
skuPicListList falseThe 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.
originalPriceBigDecimal falseThe original price of the SKU. It supports up to two decimal places. If the value is empty, it defaults to 0.
salePriceBigDecimal falseThe sales price of the SKU. It supports up to two decimal places. If the value is empty, it defaults to 0.
inventoryInteger falseThe inventory. It supports an integer. If the value is empty, it defaults to 0.
weightBigDecimal falseThe weight in kilograms (KG). It supports up to three decimal places. If the value is empty, it defaults to 0.
externalCodeString falseThe external code.
supportOutStockBuyBoolean falseSpecifies whether the buyers can place an order when the inventory is zero.
skuAttrListList falseThe list of SKU attributes.

Description of skuAttrList

Parameter nameTypeINRequiredDescription
attrCodeString trueThe code of the specified attribute.
attrValueIdLong trueThe ID of the specified attribute value.
attrNameString falseThe name of the specified attribute.
attrValueNameString falseThe name of the specified attribute value.

Return parameter

Parameter nameTypeDescription
resultCommodityAddOpenApiVOThe returned result.

Description of result

Parameter nameTypeDescription
commodity_codeStringThe unique code of the specified commodity.

Request example

POST: /v1.0/cloud/ecm/store/admin/api/commodity/edit
{
  "mall_code": "8h4tiureddm***",
  "site_code": "CN",
  "commodity_code": "CMaplyr4bzck***",
  "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",
  "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": true,
  "jump_link": "www.demo.com/home",
  "publish": true,
  "sku_list": [
    {
      "skuCode": "SKba0j4xcti***",
      "skuPicList": [
        "https://image-demo.oss-cn-hangzhou.aliyuncs.com/exa****.jpg"
      ],
      "externalCode": "",
      "inventory": 100,
      "originalPrice": 1,
      "salePrice": 2,
      "supportOutStockBuy": false,
      "skuAttrList": [
        {
          "attrCode": "ATci8mev9w0***",
          "attrName": "Color",
          "attrValueId": 6181512,
          "attrValueName": "White"
        }
      ],
      "weight": 0
    }
  ]
}

Return example

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

Error code

For more information, see error code.

Error codeError messageDescription
2000000params errorParameter error.
2001000shop does not existThe store (site) does not exist.
2000001character limit exceededExceeded the character quantity limit.
2002002commodity title already existsThe commodity title already exists.
2002003category does not existThe commodity category does not exist.
2002004failed to add commodityFailed to add the commodity.
2002201sku exceeds the maximum limitThe number of SKUs exceeds the upper limit.
2002202sku attribute does not existThe SKU attribute does not exist.
2002203the sku combination rule is wrongThe SKU is not combined according to the specified rules.
2004000image size exceeds limitThe size of the media file exceeds the upper limit.
2004001the number of pictures exceeds the limitThe number of images exceeds the upper limit.
2004002picture errorImage error.
2004003video errorVideo file error.