登录
退出
首页
开放版图
苏宁有货
商家后台
文档中心
文档中心
API文档
消息中心
平台公告
工单
我的工单
提交工单
控制台
SDK调用示例
suning.saleoff.publishcm.add/
调用示例(JAVA)
复制全部代码
import com.suning.api.entity.saleoff.PublishcmAddRequest; import com.suning.api.entity.saleoff.PublishcmAddResponse; PublishcmAddRequest request = new PublishcmAddRequest(); request.setAfterSaleServiceDec("22"); ChildItem childItem= new ChildItem(); childItem.setItemCodeX("561"); childItem.setPriceX("11"); childItem.setProductCodeX("104007723"); childItem.setSupplierImgAUrl("http://1.jpg"); List
childItemList =new ArrayList
(); childItemList.add(childItem); request.setChildItem(childItemList); request.setCmTitle("商品标题"); DetailModule detailModule= new DetailModule(); detailModule.setContent("模块化详情内容"); detailModule.setModuleId("R6151002_1"); detailModule.setModuleName("模块名称"); detailModule.setNum("1"); detailModule.setType("cat_mod"); List
detailModuleList =new ArrayList
(); detailModuleList.add(detailModule); request.setDetailModule(detailModuleList); request.setDiaoPaiPic("http://1.jpg"); request.setIntroduction("商家商品介绍"); request.setItemCode("主商品商家商品编码。"); request.setLtpic("http://1.jpg"); request.setMainPicVideoCode("108625"); PackingList packingList= new PackingList(); packingList.setPackingListName("装箱清单名单"); packingList.setPackingListQty("1"); List
packingListList =new ArrayList
(); packingListList.add(packingList); request.setPackingList(packingListList); request.setPrice("123"); request.setProductCode("102652866"); request.setSellPoint("卖点"); request.setSupplierImgUrlA("http://1.jpg"); request.setSupplierImgUrlB("http://1.jpg"); request.setSupplierImgUrlC("http://1.jpg"); request.setSupplierImgUrlD("http://1.jpg"); request.setSupplierImgUrlE("http://1.jpg"); request.setTransparent("透明图URL"); 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 -> setAfterSaleServiceDec("22"); $childItem= new ChildItem(); $childItem-> setItemCodeX("561"); $childItem-> setPriceX("11"); $childItem-> setProductCodeX("104007723"); $childItem-> setSupplierImgAUrl("http://1.jpg"); $req -> setChildItem(array($childItem)); $req -> setCmTitle("商品标题"); $detailModule= new DetailModule(); $detailModule-> setContent("模块化详情内容"); $detailModule-> setModuleId("R6151002_1"); $detailModule-> setModuleName("模块名称"); $detailModule-> setNum("1"); $detailModule-> setType("cat_mod"); $req -> setDetailModule(array($detailModule)); $req -> setDiaoPaiPic("http://1.jpg"); $req -> setIntroduction("商家商品介绍"); $req -> setItemCode("主商品商家商品编码。"); $req -> setLtpic("http://1.jpg"); $req -> setMainPicVideoCode("108625"); $packingList= new PackingList(); $packingList-> setPackingListName("装箱清单名单"); $packingList-> setPackingListQty("1"); $req -> setPackingList(array($packingList)); $req -> setPrice("123"); $req -> setProductCode("102652866"); $req -> setSellPoint("卖点"); $req -> setSupplierImgUrlA("http://1.jpg"); $req -> setSupplierImgUrlB("http://1.jpg"); $req -> setSupplierImgUrlC("http://1.jpg"); $req -> setSupplierImgUrlD("http://1.jpg"); $req -> setSupplierImgUrlE("http://1.jpg"); $req -> setTransparent("透明图URL"); $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; PublishcmAddRequest request = new PublishcmAddRequest(); request.afterSaleServiceDec="22"; PublishcmAddChildItemReq childItem= new PublishcmAddChildItemReq(); childItem.itemCodeX="561"; childItem.priceX="11"; childItem.productCodeX="104007723"; childItem.supplierImgAUrl="http://1.jpg"; List
childItemList =new ArrayList
(); childItemList.add(childItem); request.childItem=childItemList; request.cmTitle="商品标题"; PublishcmAddDetailModuleReq detailModule= new PublishcmAddDetailModuleReq(); detailModule.content="模块化详情内容"; detailModule.moduleId="R6151002_1"; detailModule.moduleName="模块名称"; detailModule.num="1"; detailModule.type="cat_mod"; List
detailModuleList =new ArrayList
(); detailModuleList.add(detailModule); request.detailModule=detailModuleList; request.diaoPaiPic="http://1.jpg"; request.introduction="商家商品介绍"; request.itemCode="主商品商家商品编码。"; request.ltpic="http://1.jpg"; request.mainPicVideoCode="108625"; PublishcmAddPackingListReq packingList= new PublishcmAddPackingListReq(); packingList.packingListName="装箱清单名单"; packingList.packingListQty="1"; List
packingListList =new ArrayList
(); packingListList.add(packingList); request.packingList=packingListList; request.price="123"; request.productCode="102652866"; request.sellPoint="卖点"; request.supplierImgUrlA="http://1.jpg"; request.supplierImgUrlB="http://1.jpg"; request.supplierImgUrlC="http://1.jpg"; request.supplierImgUrlD="http://1.jpg"; request.supplierImgUrlE="http://1.jpg"; request.transparent="透明图URL"; 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.saleoff.PublishcmAddRequest() request.afterSaleServiceDec="22"; request. childItem= [{ itemCodeX:"561", priceX:"11", productCodeX:"104007723", supplierImgAUrl:"http://1.jpg", }]; request.cmTitle="商品标题"; request. detailModule= [{ content:"模块化详情内容", moduleId:"R6151002_1", moduleName:"模块名称", num:"1", type:"cat_mod", }]; request.diaoPaiPic="http://1.jpg"; request.introduction="商家商品介绍"; request.itemCode="主商品商家商品编码。"; request.ltpic="http://1.jpg"; request.mainPicVideoCode="108625"; request. packingList= [{ packingListName:"装箱清单名单", packingListQty:"1", }]; request.price="123"; request.productCode="102652866"; request.sellPoint="卖点"; request.supplierImgUrlA="http://1.jpg"; request.supplierImgUrlB="http://1.jpg"; request.supplierImgUrlC="http://1.jpg"; request.supplierImgUrlD="http://1.jpg"; request.supplierImgUrlE="http://1.jpg"; request.transparent="透明图URL"; 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)