登录
退出
首页
开放版图
苏宁有货
商家后台
文档中心
文档中心
API文档
消息中心
平台公告
工单
我的工单
提交工单
控制台
SDK调用示例
suning.saleoff.item.add/
调用示例(JAVA)
复制全部代码
import com.suning.api.entity.saleoff.ItemAddRequest; import com.suning.api.entity.saleoff.ItemAddResponse; ItemAddRequest request = new ItemAddRequest(); request.setActivityPic("http://1.jpg"); request.setBarpic("http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg"); request.setBrandCode("A101"); request.setCategoryCode("R6101011"); ChildItem childItem= new ChildItem(); childItem.setBarcode("11"); childItem.setBarpicX("http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg"); childItem.setItemCodeX("子商品商家商品编码"); ParsX parsX= new ParsX(); parsX.setParCodeX("G00001"); parsX.setParValueX("红色"); List
parsXList =new ArrayList
(); parsXList.add(parsX); childItem.setParsX(parsXList); childItem.setPriceX("1.11"); childItem.setSupplierImgAUrl("http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg"); List
childItemList =new ArrayList
(); childItemList.add(childItem); request.setChildItem(childItemList); request.setCmTitle("商品标题"); DetailModule detailModule= new DetailModule(); detailModule.setContent("模块化详情内容"); detailModule.setModuleId("R2701001_1"); detailModule.setModuleName("优惠信息"); detailModule.setNum("1"); detailModule.setType("cat_mod"); List
detailModuleList =new ArrayList
(); detailModuleList.add(detailModule); request.setDetailModule(detailModuleList); request.setIntroduction("电脑详情"); request.setItemCode("商家商品编码"); request.setLtpic("http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg"); request.setMainPicVideoCode("108625"); PackingList packingList= new PackingList(); packingList.setPackingListName("电脑"); packingList.setPackingListQty("1"); List
packingListList =new ArrayList
(); packingListList.add(packingList); request.setPackingList(packingListList); Pars pars= new Pars(); pars.setParCode("cm_model"); pars.setParValue("1"); List
parsList =new ArrayList
(); parsList.add(pars); request.setPars(parsList); request.setPrice("100.11"); request.setProductName("商品名称"); request.setSellPoint("卖点"); request.setSupplierImg1Url("http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg"); request.setSupplierImg2Url("http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg"); request.setSupplierImg3Url("http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg"); request.setSupplierImg4Url("http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg"); request.setSupplierImg5Url("http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg"); request.setVideoCode("108625"); //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 { ItemAddResponse response = client.excute(request); System.out.println("返回json/xml格式数据 :" + response.getBody()); } catch (SuningApiException e) { e.printStackTrace(); }
调用示例(PHP)
复制全部代码
$req = new ItemAddRequest(); $req -> setActivityPic("http://1.jpg"); $req -> setBarpic("http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg"); $req -> setBrandCode("A101"); $req -> setCategoryCode("R6101011"); $childItem= new ChildItem(); $childItem-> setBarcode("11"); $childItem-> setBarpicX("http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg"); $childItem-> setItemCodeX("子商品商家商品编码"); $parsX= new ParsX(); $parsX-> setParCodeX("G00001"); $parsX-> setParValueX("红色"); $childItem-> setParsX(array($parsX)); $childItem-> setPriceX("1.11"); $childItem-> setSupplierImgAUrl("http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg"); $req -> setChildItem(array($childItem)); $req -> setCmTitle("商品标题"); $detailModule= new DetailModule(); $detailModule-> setContent("模块化详情内容"); $detailModule-> setModuleId("R2701001_1"); $detailModule-> setModuleName("优惠信息"); $detailModule-> setNum("1"); $detailModule-> setType("cat_mod"); $req -> setDetailModule(array($detailModule)); $req -> setIntroduction("电脑详情"); $req -> setItemCode("商家商品编码"); $req -> setLtpic("http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg"); $req -> setMainPicVideoCode("108625"); $packingList= new PackingList(); $packingList-> setPackingListName("电脑"); $packingList-> setPackingListQty("1"); $req -> setPackingList(array($packingList)); $pars= new Pars(); $pars-> setParCode("cm_model"); $pars-> setParValue("1"); $req -> setPars(array($pars)); $req -> setPrice("100.11"); $req -> setProductName("商品名称"); $req -> setSellPoint("卖点"); $req -> setSupplierImg1Url("http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg"); $req -> setSupplierImg2Url("http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg"); $req -> setSupplierImg3Url("http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg"); $req -> setSupplierImg4Url("http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg"); $req -> setSupplierImg5Url("http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg"); $req -> setVideoCode("108625"); //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.CustomSaleoffRequest; using suning_api_sdk.BizResponse.CustomSaleoffResponse; using suning_api_sdk.Models.CustomSaleoffModel; ItemAddRequest request = new ItemAddRequest(); request.activityPic="http://1.jpg"; request.barpic="http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg"; request.brandCode="A101"; request.categoryCode="R6101011"; ItemAddChildItemReq childItem= new ItemAddChildItemReq(); childItem.barcode="11"; childItem.barpicX="http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg"; childItem.itemCodeX="子商品商家商品编码"; ItemAddParsXReq parsX= new ItemAddParsXReq(); parsX.parCodeX="G00001"; parsX.parValueX="红色"; List
parsXList =new ArrayList
(); parsXList.add(parsX); childItem.parsX=parsXList; childItem.priceX="1.11"; childItem.supplierImgAUrl="http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg"; List
childItemList =new ArrayList
(); childItemList.add(childItem); request.childItem=childItemList; request.cmTitle="商品标题"; ItemAddDetailModuleReq detailModule= new ItemAddDetailModuleReq(); detailModule.content="模块化详情内容"; detailModule.moduleId="R2701001_1"; detailModule.moduleName="优惠信息"; detailModule.num="1"; detailModule.type="cat_mod"; List
detailModuleList =new ArrayList
(); detailModuleList.add(detailModule); request.detailModule=detailModuleList; request.introduction="电脑详情"; request.itemCode="商家商品编码"; request.ltpic="http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg"; request.mainPicVideoCode="108625"; ItemAddPackingListReq packingList= new ItemAddPackingListReq(); packingList.packingListName="电脑"; packingList.packingListQty="1"; List
packingListList =new ArrayList
(); packingListList.add(packingList); request.packingList=packingListList; ItemAddParsReq pars= new ItemAddParsReq(); pars.parCode="cm_model"; pars.parValue="1"; List
parsList =new ArrayList
(); parsList.add(pars); request.pars=parsList; request.price="100.11"; request.productName="商品名称"; request.sellPoint="卖点"; request.supplierImg1Url="http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg"; request.supplierImg2Url="http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg"; request.supplierImg3Url="http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg"; request.supplierImg4Url="http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg"; request.supplierImg5Url="http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg"; request.videoCode="108625"; //开启日志调试,当测试稳定之后建议设置为 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); ItemAddResponse response = client.Execute(request);
调用示例(PYTHON)
复制全部代码
# -*- coding: utf-8 -*- import suning.api request = suning.api.saleoff.ItemAddRequest() request.activityPic="http://1.jpg"; request.barpic="http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg"; request.brandCode="A101"; request.categoryCode="R6101011"; request. childItem= [{ barcode:"11", barpicX:"http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg", itemCodeX:"子商品商家商品编码", parsX: [{ parCodeX:"G00001", parValueX:"红色", }], priceX:"1.11", supplierImgAUrl:"http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg", }]; request.cmTitle="商品标题"; request. detailModule= [{ content:"模块化详情内容", moduleId:"R2701001_1", moduleName:"优惠信息", num:"1", type:"cat_mod", }]; request.introduction="电脑详情"; request.itemCode="商家商品编码"; request.ltpic="http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg"; request.mainPicVideoCode="108625"; request. packingList= [{ packingListName:"电脑", packingListQty:"1", }]; request. pars= [{ parCode:"cm_model", parValue:"1", }]; request.price="100.11"; request.productName="商品名称"; request.sellPoint="卖点"; request.supplierImg1Url="http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg"; request.supplierImg2Url="http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg"; request.supplierImg3Url="http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg"; request.supplierImg4Url="http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg"; request.supplierImg5Url="http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg"; request.videoCode="108625"; 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)