登录
退出
首页
开放版图
苏宁有货
商家后台
文档中心
文档中心
API文档
消息中心
平台公告
工单
我的工单
提交工单
控制台
SDK调用示例
suning.oto.publishcm.add/
调用示例(JAVA)
复制全部代码
import com.suning.api.entity.oto.PublishcmAddRequest; import com.suning.api.entity.oto.PublishcmAddResponse; PublishcmAddRequest request = new PublishcmAddRequest(); request.setAssortCode("11111111"); ChildItem childItem= new ChildItem(); childItem.setItemCode("561"); childItem.setPrice("11"); childItem.setProductCode("104007723"); childItem.setSupplierImg1Url("1"); List
childItemList =new ArrayList
(); childItemList.add(childItem); request.setChildItem(childItemList); request.setCmTitle("11"); DetailModule detailModule= new DetailModule(); detailModule.setContent("模块化详情内容"); detailModule.setModuleId("1"); detailModule.setModuleName("1"); detailModule.setNum("1"); detailModule.setType("cat_mod"); List
detailModuleList =new ArrayList
(); detailModuleList.add(detailModule); request.setDetailModule(detailModuleList); request.setIntroduction("商家商品介绍"); request.setItemCode("789123"); request.setMainPicVideoCode("108625"); PackingList packingList= new PackingList(); packingList.setPackingListName(" 电脑"); packingList.setPackingListQty("1"); List
packingListList =new ArrayList
(); packingListList.add(packingList); request.setPackingList(packingListList); request.setPrice("5.00"); request.setProductCode("102652866"); request.setSaleDate("2016-09-30"); request.setSaleSet("1"); request.setSellPoint("卖点"); request.setSupplierImg1Url("1"); request.setSupplierImg2Url("1"); request.setSupplierImg3Url("1"); request.setSupplierImg4Url("1"); request.setSupplierImg5Url("1"); 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 { PublishcmAddResponse response = client.excute(request); System.out.println("返回json/xml格式数据 :" + response.getBody()); } catch (SuningApiException e) { e.printStackTrace(); }
调用示例(PHP)
复制全部代码
$req = new PublishcmAddRequest(); $req -> setAssortCode("11111111"); $childItem= new ChildItem(); $childItem-> setItemCode("561"); $childItem-> setPrice("11"); $childItem-> setProductCode("104007723"); $childItem-> setSupplierImg1Url("1"); $req -> setChildItem(array($childItem)); $req -> setCmTitle("11"); $detailModule= new DetailModule(); $detailModule-> setContent("模块化详情内容"); $detailModule-> setModuleId("1"); $detailModule-> setModuleName("1"); $detailModule-> setNum("1"); $detailModule-> setType("cat_mod"); $req -> setDetailModule(array($detailModule)); $req -> setIntroduction("商家商品介绍"); $req -> setItemCode("789123"); $req -> setMainPicVideoCode("108625"); $packingList= new PackingList(); $packingList-> setPackingListName(" 电脑"); $packingList-> setPackingListQty("1"); $req -> setPackingList(array($packingList)); $req -> setPrice("5.00"); $req -> setProductCode("102652866"); $req -> setSaleDate("2016-09-30"); $req -> setSaleSet("1"); $req -> setSellPoint("卖点"); $req -> setSupplierImg1Url("1"); $req -> setSupplierImg2Url("1"); $req -> setSupplierImg3Url("1"); $req -> setSupplierImg4Url("1"); $req -> setSupplierImg5Url("1"); $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; PublishcmAddRequest request = new PublishcmAddRequest(); request.assortCode="11111111"; PublishcmAddChildItemReq childItem= new PublishcmAddChildItemReq(); childItem.itemCode="561"; childItem.price="11"; childItem.productCode="104007723"; childItem.supplierImg1Url="1"; List
childItemList =new ArrayList
(); childItemList.add(childItem); request.childItem=childItemList; request.cmTitle="11"; PublishcmAddDetailModuleReq detailModule= new PublishcmAddDetailModuleReq(); detailModule.content="模块化详情内容"; detailModule.moduleId="1"; detailModule.moduleName="1"; detailModule.num="1"; detailModule.type="cat_mod"; List
detailModuleList =new ArrayList
(); detailModuleList.add(detailModule); request.detailModule=detailModuleList; request.introduction="商家商品介绍"; request.itemCode="789123"; request.mainPicVideoCode="108625"; PublishcmAddPackingListReq packingList= new PublishcmAddPackingListReq(); packingList.packingListName=" 电脑"; packingList.packingListQty="1"; List
packingListList =new ArrayList
(); packingListList.add(packingList); request.packingList=packingListList; request.price="5.00"; request.productCode="102652866"; request.saleDate="2016-09-30"; request.saleSet="1"; request.sellPoint="卖点"; request.supplierImg1Url="1"; request.supplierImg2Url="1"; request.supplierImg3Url="1"; request.supplierImg4Url="1"; request.supplierImg5Url="1"; 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); PublishcmAddResponse response = client.Execute(request);
调用示例(PYTHON)
复制全部代码
# -*- coding: utf-8 -*- import suning.api request = suning.api.oto.PublishcmAddRequest() request.assortCode="11111111"; request. childItem= [{ itemCode:"561", price:"11", productCode:"104007723", supplierImg1Url:"1", }]; request.cmTitle="11"; request. detailModule= [{ content:"模块化详情内容", moduleId:"1", moduleName:"1", num:"1", type:"cat_mod", }]; request.introduction="商家商品介绍"; request.itemCode="789123"; request.mainPicVideoCode="108625"; request. packingList= [{ packingListName:" 电脑", packingListQty:"1", }]; request.price="5.00"; request.productCode="102652866"; request.saleDate="2016-09-30"; request.saleSet="1"; request.sellPoint="卖点"; request.supplierImg1Url="1"; request.supplierImg2Url="1"; request.supplierImg3Url="1"; request.supplierImg4Url="1"; request.supplierImg5Url="1"; 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)