登录
退出
首页
开放版图
苏宁有货
商家后台
文档中心
文档中心
API文档
消息中心
平台公告
工单
我的工单
提交工单
控制台
SDK调用示例
suning.store.commodityedit.create/
调用示例(JAVA)
复制全部代码
import com.suning.api.entity.store.CommodityeditCreateRequest; import com.suning.api.entity.store.CommodityeditCreateResponse; CommodityeditCreateRequest request = new CommodityeditCreateRequest(); request.setAdvertise("xxx"); request.setApplyCode("1be9df8f-94fb-43f9-962c-125bfc621a6e"); request.setAppStoreCode("xx"); AttrInfo attrInfo= new AttrInfo(); AttrChoiceInfo attrChoiceInfo= new AttrChoiceInfo(); attrChoiceInfo.setAttrChoiceCode("xxx"); attrChoiceInfo.setAttrChoiceName("加冰"); List
attrChoiceInfoList =new ArrayList
(); attrChoiceInfoList.add(attrChoiceInfo); attrInfo.setAttrChoiceInfo(attrChoiceInfoList); attrInfo.setAttrCode("xxx"); attrInfo.setAttrIsMulti("0(0:否 1:是)"); attrInfo.setAttrName("温度"); List
attrInfoList =new ArrayList
(); attrInfoList.add(attrInfo); request.setAttrInfo(attrInfoList); request.setBrandCode("xxx"); request.setBrgew("xx"); request.setCategoryCode("xx"); request.setClassifyCode("xxx"); request.setCmBarcode("xx"); request.setDeliveryAttr("01(01-常温 02-恒温 03-冷藏 04-冷冻)"); request.setImmediateAppoint("01(01:支持 02:不支持)"); request.setImmediateAppointTime("xxx"); request.setOperType("00(00:新建 01:审核不通过时修改 02:编辑)"); request.setPackingPrice("xxx"); request.setPicUrl("http://xx/xx/xx/xx/x1.jpg(逗号隔开共5张)"); request.setProductCode("xxx"); request.setProductName("xxx"); request.setPurchaseMin("1"); request.setQty("xxx"); request.setSecondClassifyCode("xxx"); request.setSellHoursType("01"); request.setSellPrice("xxx"); request.setSellStatus("1(1:上架 2:下架)"); request.setServiceTime("1-24"); StandardInfo standardInfo= new StandardInfo(); ChoiceInfo choiceInfo= new ChoiceInfo(); choiceInfo.setChoiceCode("xxx"); choiceInfo.setChoiceName("大杯"); choiceInfo.setChoicePrice("1"); List
choiceInfoList =new ArrayList
(); choiceInfoList.add(choiceInfo); standardInfo.setChoiceInfo(choiceInfoList); standardInfo.setIsMulti("0(0:否 1:是)"); standardInfo.setStandardCode("xxx"); standardInfo.setStandardName("尺寸"); List
standardInfoList =new ArrayList
(); standardInfoList.add(standardInfo); request.setStandardInfo(standardInfoList); request.setStoreCode("xxx"); request.setSupplierCmCode("xxx"); //api入参校验逻辑开关,当测试稳定之后建议设置为 false 或者删除该行 request.setCheckParam(true); String serverUrl = "https://openpre.cnsuning.com/api/http/sopRequest"; String appKey = "你的appKey"; String appSecret = "你的appSecret"; DefaultSuningClient client = new DefaultSuningClient(serverUrl, appKey,appSecret, "json"); try { CommodityeditCreateResponse response = client.excute(request); System.out.println("返回json/xml格式数据 :" + response.getBody()); } catch (SuningApiException e) { e.printStackTrace(); }
调用示例(PHP)
复制全部代码
$req = new CommodityeditCreateRequest(); $req -> setAdvertise("xxx"); $req -> setApplyCode("1be9df8f-94fb-43f9-962c-125bfc621a6e"); $req -> setAppStoreCode("xx"); $attrInfo= new AttrInfo(); $attrChoiceInfo= new AttrChoiceInfo(); $attrChoiceInfo-> setAttrChoiceCode("xxx"); $attrChoiceInfo-> setAttrChoiceName("加冰"); $attrInfo-> setAttrChoiceInfo(array($attrChoiceInfo)); $attrInfo-> setAttrCode("xxx"); $attrInfo-> setAttrIsMulti("0(0:否 1:是)"); $attrInfo-> setAttrName("温度"); $req -> setAttrInfo(array($attrInfo)); $req -> setBrandCode("xxx"); $req -> setBrgew("xx"); $req -> setCategoryCode("xx"); $req -> setClassifyCode("xxx"); $req -> setCmBarcode("xx"); $req -> setDeliveryAttr("01(01-常温 02-恒温 03-冷藏 04-冷冻)"); $req -> setImmediateAppoint("01(01:支持 02:不支持)"); $req -> setImmediateAppointTime("xxx"); $req -> setOperType("00(00:新建 01:审核不通过时修改 02:编辑)"); $req -> setPackingPrice("xxx"); $req -> setPicUrl("http://xx/xx/xx/xx/x1.jpg(逗号隔开共5张)"); $req -> setProductCode("xxx"); $req -> setProductName("xxx"); $req -> setPurchaseMin("1"); $req -> setQty("xxx"); $req -> setSecondClassifyCode("xxx"); $req -> setSellHoursType("01"); $req -> setSellPrice("xxx"); $req -> setSellStatus("1(1:上架 2:下架)"); $req -> setServiceTime("1-24"); $standardInfo= new StandardInfo(); $choiceInfo= new ChoiceInfo(); $choiceInfo-> setChoiceCode("xxx"); $choiceInfo-> setChoiceName("大杯"); $choiceInfo-> setChoicePrice("1"); $standardInfo-> setChoiceInfo(array($choiceInfo)); $standardInfo-> setIsMulti("0(0:否 1:是)"); $standardInfo-> setStandardCode("xxx"); $standardInfo-> setStandardName("尺寸"); $req -> setStandardInfo(array($standardInfo)); $req -> setStoreCode("xxx"); $req -> setSupplierCmCode("xxx"); //api入参校验逻辑开关,当测试稳定之后建议设置为 false 或者删除该行 $req -> setCheckParam('true'); $serverUrl = "https://openpre.cnsuning.com/api/http/sopRequest"; $appKey = "你的appKey"; $appSecret = "你的appSecret"; $client = new DefaultSuningClient($serverUrl,$appKey,$appSecret,'json'); $resp = $client -> execute($req); print_r("返回响应报文:".$resp);
调用示例(.NET)
复制全部代码
using suning_api_sdk.BizRequest.CustomStoreRequest; using suning_api_sdk.BizResponse.CustomStoreResponse; using suning_api_sdk.Models.CustomStoreModel; CommodityeditCreateRequest request = new CommodityeditCreateRequest(); request.advertise="xxx"; request.applyCode="1be9df8f-94fb-43f9-962c-125bfc621a6e"; request.appStoreCode="xx"; CommodityeditCreateAttrInfoReq attrInfo= new CommodityeditCreateAttrInfoReq(); CommodityeditCreateAttrChoiceInfoReq attrChoiceInfo= new CommodityeditCreateAttrChoiceInfoReq(); attrChoiceInfo.attrChoiceCode="xxx"; attrChoiceInfo.attrChoiceName="加冰"; List
attrChoiceInfoList =new ArrayList
(); attrChoiceInfoList.add(attrChoiceInfo); attrInfo.attrChoiceInfo=attrChoiceInfoList; attrInfo.attrCode="xxx"; attrInfo.attrIsMulti="0(0:否 1:是)"; attrInfo.attrName="温度"; List
attrInfoList =new ArrayList
(); attrInfoList.add(attrInfo); request.attrInfo=attrInfoList; request.brandCode="xxx"; request.brgew="xx"; request.categoryCode="xx"; request.classifyCode="xxx"; request.cmBarcode="xx"; request.deliveryAttr="01(01-常温 02-恒温 03-冷藏 04-冷冻)"; request.immediateAppoint="01(01:支持 02:不支持)"; request.immediateAppointTime="xxx"; request.operType="00(00:新建 01:审核不通过时修改 02:编辑)"; request.packingPrice="xxx"; request.picUrl="http://xx/xx/xx/xx/x1.jpg(逗号隔开共5张)"; request.productCode="xxx"; request.productName="xxx"; request.purchaseMin="1"; request.qty="xxx"; request.secondClassifyCode="xxx"; request.sellHoursType="01"; request.sellPrice="xxx"; request.sellStatus="1(1:上架 2:下架)"; request.serviceTime="1-24"; CommodityeditCreateStandardInfoReq standardInfo= new CommodityeditCreateStandardInfoReq(); CommodityeditCreateChoiceInfoReq choiceInfo= new CommodityeditCreateChoiceInfoReq(); choiceInfo.choiceCode="xxx"; choiceInfo.choiceName="大杯"; choiceInfo.choicePrice="1"; List
choiceInfoList =new ArrayList
(); choiceInfoList.add(choiceInfo); standardInfo.choiceInfo=choiceInfoList; standardInfo.isMulti="0(0:否 1:是)"; standardInfo.standardCode="xxx"; standardInfo.standardName="尺寸"; List
standardInfoList =new ArrayList
(); standardInfoList.add(standardInfo); request.standardInfo=standardInfoList; request.storeCode="xxx"; request.supplierCmCode="xxx"; //开启日志调试,当测试稳定之后建议设置为 false 或者删除该行 SuningLogger.IsLogDebug = true; string serverUrl = "https://openpre.cnsuning.com/api/http/sopRequest"; string appKey = "你的appKey"; string appSecret = "你的appSecret"; ISuningClient client = new DefaultSuningClient(serverUrl, appKey,appSecret); CommodityeditCreateResponse response = client.Execute(request);
调用示例(PYTHON)
复制全部代码
# -*- coding: utf-8 -*- import suning.api request = suning.api.store.CommodityeditCreateRequest() request.advertise="xxx"; request.applyCode="1be9df8f-94fb-43f9-962c-125bfc621a6e"; request.appStoreCode="xx"; request. attrInfo= [{ attrChoiceInfo: [{ attrChoiceCode:"xxx", attrChoiceName:"加冰", }], attrCode:"xxx", attrIsMulti:"0(0:否 1:是)", attrName:"温度", }]; request.brandCode="xxx"; request.brgew="xx"; request.categoryCode="xx"; request.classifyCode="xxx"; request.cmBarcode="xx"; request.deliveryAttr="01(01-常温 02-恒温 03-冷藏 04-冷冻)"; request.immediateAppoint="01(01:支持 02:不支持)"; request.immediateAppointTime="xxx"; request.operType="00(00:新建 01:审核不通过时修改 02:编辑)"; request.packingPrice="xxx"; request.picUrl="http://xx/xx/xx/xx/x1.jpg(逗号隔开共5张)"; request.productCode="xxx"; request.productName="xxx"; request.purchaseMin="1"; request.qty="xxx"; request.secondClassifyCode="xxx"; request.sellHoursType="01"; request.sellPrice="xxx"; request.sellStatus="1(1:上架 2:下架)"; request.serviceTime="1-24"; request. standardInfo= [{ choiceInfo: [{ choiceCode:"xxx", choiceName:"大杯", choicePrice:"1", }], isMulti:"0(0:否 1:是)", standardCode:"xxx", standardName:"尺寸", }]; request.storeCode="xxx"; request.supplierCmCode="xxx"; domain = "https://openpre.cnsuning.com" appKey = "你的appKey" appSecret = "你的appSecret" request.setDomainInfo(domain,"80") request.setAppInfo(appKey,appSecret) try: result=request.getResponse() print(result) except Exception as e: print(e)