登录
退出
首页
开放版图
苏宁有货
商家后台
文档中心
文档中心
API文档
消息中心
平台公告
工单
我的工单
提交工单
控制台
SDK调用示例
suning.oto.item.add/
调用示例(JAVA)
复制全部代码
import com.suning.api.entity.oto.ItemAddRequest; import com.suning.api.entity.oto.ItemAddResponse; ItemAddRequest request = new ItemAddRequest(); request.setAssortCode("210002118"); 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.setBarpic("http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg"); childItem.setItemCode("111"); Pars pars= new Pars(); pars.setParCode("LAENG"); pars.setParValue("1"); List
parsList =new ArrayList
(); parsList.add(pars); childItem.setPars(parsList); childItem.setPrice("1.11"); childItem.setSupplierImg1Url("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("111"); 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("LAENG"); pars.setParValue("1"); List
parsList =new ArrayList
(); parsList.add(pars); request.setPars(parsList); request.setPrice("100.11"); request.setProductName("电脑"); request.setSaleDate("2016-10-11"); request.setSaleSet("1"); 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.setTargetChannel("1"); 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 -> setAssortCode("210002118"); $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-> setBarpic("http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg"); $childItem-> setItemCode("111"); $pars= new Pars(); $pars-> setParCode("LAENG"); $pars-> setParValue("1"); $childItem-> setPars(array($pars)); $childItem-> setPrice("1.11"); $childItem-> setSupplierImg1Url("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("111"); $req -> setMainPicVideoCode("108625"); $packingList= new PackingList(); $packingList-> setPackingListName("电脑"); $packingList-> setPackingListQty("1"); $req -> setPackingList(array($packingList)); $pars= new Pars(); $pars-> setParCode("LAENG"); $pars-> setParValue("1"); $req -> setPars(array($pars)); $req -> setPrice("100.11"); $req -> setProductName("电脑"); $req -> setSaleDate("2016-10-11"); $req -> setSaleSet("1"); $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 -> setTargetChannel("1"); $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.CustomOtoRequest; using suning_api_sdk.BizResponse.CustomOtoResponse; using suning_api_sdk.Models.CustomOtoModel; ItemAddRequest request = new ItemAddRequest(); request.assortCode="210002118"; 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.barpic="http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg"; childItem.itemCode="111"; ItemAddParsReq pars= new ItemAddParsReq(); pars.parCode="LAENG"; pars.parValue="1"; List
parsList =new ArrayList
(); parsList.add(pars); childItem.pars=parsList; childItem.price="1.11"; childItem.supplierImg1Url="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="111"; 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="LAENG"; pars.parValue="1"; List
parsList =new ArrayList
(); parsList.add(pars); request.pars=parsList; request.price="100.11"; request.productName="电脑"; request.saleDate="2016-10-11"; request.saleSet="1"; 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.targetChannel="1"; 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.oto.ItemAddRequest() request.assortCode="210002118"; request.barpic="http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg"; request.brandCode="A101"; request.categoryCode="R6101011"; request. childItem= [{ barcode:"11", barpic:"http://10.19.95.100/uimg/sop/commodity/181223352817344502976922_x.jpg", itemCode:"111", pars: [{ parCode:"LAENG", parValue:"1", }], price:"1.11", supplierImg1Url:"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="111"; request.mainPicVideoCode="108625"; request. packingList= [{ packingListName:"电脑", packingListQty:"1", }]; request. pars= [{ parCode:"LAENG", parValue:"1", }]; request.price="100.11"; request.productName="电脑"; request.saleDate="2016-10-11"; request.saleSet="1"; 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.targetChannel="1"; 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)