TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
CainiaoCntecSupplierItemSavemainitemRequest req = new CainiaoCntecSupplierItemSavemainitemRequest();
CainiaoCntecSupplierItemSavemainitemRequest.MainItemSyncDto obj1 = new CainiaoCntecSupplierItemSavemainitemRequest.MainItemSyncDto();
obj1.setFeature("{\"product_item\":\"商品名称\",\"product_quantity\":\"商品数量\"}");
obj1.setProductionCountry("国产");
obj1.setItemHeight("30");
obj1.setItemWidth("20");
obj1.setItemLength("10");
obj1.setStorageConditions("常温");
obj1.setWeight("500");
obj1.setTax("0.01");
obj1.setBillContent("开票内容");
obj1.setLifeTime("10");
obj1.setBarcode("条形码");
obj1.setVideoMaterial("供应商素材视频URL");
obj1.setPackageMethod("包装方式");
obj1.setOuterBrandName("品牌名称");
obj1.setOuterBrandId("123123");
obj1.setLastLevelCategoryId("123123");
obj1.setLastLevelCategoryName("RT的部门");
obj1.setFourthLevelCategoryId("123123");
obj1.setFourthLevelCategoryName("RT的部门");
obj1.setThirdLevelCategoryId("123123");
obj1.setThirdLevelCategoryName("RT的部门");
obj1.setSecondLevelCategoryId("123123");
obj1.setSecondLevelCategoryName("RT的部门");
obj1.setFirstLevelCategoryId("121212");
obj1.setFirstLevelCategoryName("RT的部门");
obj1.setItemDescription("<p><img src=\"https://img.alicdn.com/imgextra/i1/2074370454/O1CN011FDyPREtcDfeD3N_!!2074370454-0-communitygroup.jpg\" align=\"absmiddle\"> <img src=\"https://img.alicdn.com/imgextra/i4/2074370454/O1CN011FDyPREtcDiCVUx_!!2074370454-0-communitygroup.jpg\" align=\"absmiddle\"> </p>");
obj1.setMainImageUrl("[\"https://img02.fn-mart.com//pic/5ae8133d4e2bc4458c15/K282nn7n_TLMKlVgXn/1xoamRJy3GdaZa/CsmRsVjkPMCAPFzYAAGNFNNMs0I098.jpg\",\"https://img02.fn-mart.com//pic/bd661342ad291bac0801/K28TTT1z_zCMBdugcz/7xeamRoGuRdyWa/CsmRs1z3OBiAOoSUAAMt5mRF2bo929.jpg\",\"https://img02.fn-mart.com//pic/d5a41342ad211bac2dc8/h2Hn22szD2CgKMZMJn/5YeaeGO9OaCGCa/CsmRtFz3OBqAN4WbAAHdSdpS9Q4427.jpg\"]");
obj1.setSellPoints("轻便");
obj1.setSpecifications("100g/袋");
obj1.setItemTitle("香蕉");
obj1.setOutItemId("123123");
obj1.setSupplierCode("DRF");
obj1.setModifiedTime(1619682741556L);
req.setMainItemSync(obj1);
CainiaoCntecSupplierItemSavemainitemResponse rsp = client.execute(req);
System.out.println(rsp.getBody());
ITopClient client = new DefaultTopClient(url, appkey, secret);
CainiaoCntecSupplierItemSavemainitemRequest req = new CainiaoCntecSupplierItemSavemainitemRequest();
CainiaoCntecSupplierItemSavemainitemRequest.MainItemSyncDtoDomain obj1 = new CainiaoCntecSupplierItemSavemainitemRequest.MainItemSyncDtoDomain();
obj1.Feature = "{\"product_item\":\"商品名称\",\"product_quantity\":\"商品数量\"}";
obj1.ProductionCountry = "国产";
obj1.ItemHeight = "30";
obj1.ItemWidth = "20";
obj1.ItemLength = "10";
obj1.StorageConditions = "常温";
obj1.Weight = "500";
obj1.Tax = "0.01";
obj1.BillContent = "开票内容";
obj1.LifeTime = "10";
obj1.Barcode = "条形码";
obj1.VideoMaterial = "供应商素材视频URL";
obj1.PackageMethod = "包装方式";
obj1.OuterBrandName = "品牌名称";
obj1.OuterBrandId = "123123";
obj1.LastLevelCategoryId = "123123";
obj1.LastLevelCategoryName = "RT的部门";
obj1.FourthLevelCategoryId = "123123";
obj1.FourthLevelCategoryName = "RT的部门";
obj1.ThirdLevelCategoryId = "123123";
obj1.ThirdLevelCategoryName = "RT的部门";
obj1.SecondLevelCategoryId = "123123";
obj1.SecondLevelCategoryName = "RT的部门";
obj1.FirstLevelCategoryId = "121212";
obj1.FirstLevelCategoryName = "RT的部门";
obj1.ItemDescription = "<p><img src=\"https://img.alicdn.com/imgextra/i1/2074370454/O1CN011FDyPREtcDfeD3N_!!2074370454-0-communitygroup.jpg\" align=\"absmiddle\"> <img src=\"https://img.alicdn.com/imgextra/i4/2074370454/O1CN011FDyPREtcDiCVUx_!!2074370454-0-communitygroup.jpg\" align=\"absmiddle\"> </p>";
obj1.MainImageUrl = "[\"https://img02.fn-mart.com//pic/5ae8133d4e2bc4458c15/K282nn7n_TLMKlVgXn/1xoamRJy3GdaZa/CsmRsVjkPMCAPFzYAAGNFNNMs0I098.jpg\",\"https://img02.fn-mart.com//pic/bd661342ad291bac0801/K28TTT1z_zCMBdugcz/7xeamRoGuRdyWa/CsmRs1z3OBiAOoSUAAMt5mRF2bo929.jpg\",\"https://img02.fn-mart.com//pic/d5a41342ad211bac2dc8/h2Hn22szD2CgKMZMJn/5YeaeGO9OaCGCa/CsmRtFz3OBqAN4WbAAHdSdpS9Q4427.jpg\"]";
obj1.SellPoints = "轻便";
obj1.Specifications = "100g/袋";
obj1.ItemTitle = "香蕉";
obj1.OutItemId = "123123";
obj1.SupplierCode = "DRF";
obj1.ModifiedTime = 1619682741556L;
req.MainItemSync_ = obj1;
CainiaoCntecSupplierItemSavemainitemResponse rsp = client.Execute(req);
Console.WriteLine(rsp.Body);
$c = new TopClient;
$c->appkey = $appkey;
$c->secretKey = $secret;
$req = new CainiaoCntecSupplierItemSavemainitemRequest;
$main_item_sync = new MainItemSyncDto;
$main_item_sync->feature="{\"product_item\":\"商品名称\",\"product_quantity\":\"商品数量\"}";
$main_item_sync->production_country="国产";
$main_item_sync->item_height="30";
$main_item_sync->item_width="20";
$main_item_sync->item_length="10";
$main_item_sync->storage_conditions="常温";
$main_item_sync->weight="500";
$main_item_sync->tax="0.01";
$main_item_sync->bill_content="开票内容";
$main_item_sync->life_time="10";
$main_item_sync->barcode="条形码";
$main_item_sync->video_material="供应商素材视频URL";
$main_item_sync->package_method="包装方式";
$main_item_sync->outer_brand_name="品牌名称";
$main_item_sync->outer_brand_id="123123";
$main_item_sync->last_level_category_id="123123";
$main_item_sync->last_level_category_name="RT的部门";
$main_item_sync->fourth_level_category_id="123123";
$main_item_sync->fourth_level_category_name="RT的部门";
$main_item_sync->third_level_category_id="123123";
$main_item_sync->third_level_category_name="RT的部门";
$main_item_sync->second_level_category_id="123123";
$main_item_sync->second_level_category_name="RT的部门";
$main_item_sync->first_level_category_id="121212";
$main_item_sync->first_level_category_name="RT的部门";
$main_item_sync->item_description="<p><img src=\"https://img.alicdn.com/imgextra/i1/2074370454/O1CN011FDyPREtcDfeD3N_!!2074370454-0-communitygroup.jpg\" align=\"absmiddle\"> <img src=\"https://img.alicdn.com/imgextra/i4/2074370454/O1CN011FDyPREtcDiCVUx_!!2074370454-0-communitygroup.jpg\" align=\"absmiddle\"> </p>";
$main_item_sync->main_image_url="[\"https://img02.fn-mart.com//pic/5ae8133d4e2bc4458c15/K282nn7n_TLMKlVgXn/1xoamRJy3GdaZa/CsmRsVjkPMCAPFzYAAGNFNNMs0I098.jpg\",\"https://img02.fn-mart.com//pic/bd661342ad291bac0801/K28TTT1z_zCMBdugcz/7xeamRoGuRdyWa/CsmRs1z3OBiAOoSUAAMt5mRF2bo929.jpg\",\"https://img02.fn-mart.com//pic/d5a41342ad211bac2dc8/h2Hn22szD2CgKMZMJn/5YeaeGO9OaCGCa/CsmRtFz3OBqAN4WbAAHdSdpS9Q4427.jpg\"]";
$main_item_sync->sell_points="轻便";
$main_item_sync->specifications="100g/袋";
$main_item_sync->item_title="香蕉";
$main_item_sync->out_item_id="123123";
$main_item_sync->supplier_code="DRF";
$main_item_sync->modified_time="1619682741556";
$req->setMainItemSync(json_encode($main_item_sync));
$resp = $c->execute($req);
curl -X POST 'http://gw.api.taobao.com/router/rest' \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'app_key=12129701' \
-d 'format=json' \
-d 'method=cainiao.cntec.supplier.item.savemainitem' \
-d 'partner_id=apidoc' \
-d 'sign=0B66B4971E66CFF662963418FAA1627B' \
-d 'sign_method=hmac' \
-d 'timestamp=2025-04-28+17%3A44%3A13' \
-d 'v=2.0' \
-d 'main_item_sync=null'
# -*- coding: utf-8 -*-
import top.api
req=top.api.CainiaoCntecSupplierItemSavemainitemRequest(url,port)
req.set_app_info(top.appinfo(appkey,secret))
req.main_item_sync=""
try:
resp= req.getResponse()
print(resp)
except Exception,e:
print(e)
pTopRequest pRequest = alloc_top_request();
pTopResponse pResponse = NULL;
pTaobaoClient pClient = alloc_taobao_client(url, appkey, appsecret);
set_api_name(pRequest,"cainiao.cntec.supplier.item.savemainitem");
add_param(pRequest,"main_item_sync","数据结构JSON示例");
pResponse = top_execute(pClient,pRequest,NULL);
printf("ret code:%d\n",pResponse->code);
if(pResponse->code == 0){
pTopResponseIterator ite = init_response_iterator(pResponse);
pResultItem pResultItem = alloc_result_item();
while(parseNext(ite, pResultItem) == 0){
printf("%s:%s\n",pResultItem->key,pResultItem->value);
}
destroy_response_iterator(ite);
destroy_result_item(pResultItem);
}
destroy_top_request(pRequest);
destroy_top_response(pResponse);
destroy_taobao_client(pClient);
TopClient = require('./topClient').TopClient;
var client = new TopClient({
'appkey': 'appkey',
'appsecret': 'secret',
'REST_URL': 'http://gw.api.taobao.com/router/rest'
});
client.execute('cainiao.cntec.supplier.item.savemainitem', {
'main_item_sync':'数据结构JSON示例'
}, function(error, response) {
if (!error) console.log(response);
else console.log(error);
})