登录
退出
首页
开放版图
苏宁有货
商家后台
文档中心
文档中心
API文档
消息中心
平台公告
工单
我的工单
提交工单
控制台
SDK调用示例
suning.sngoods.productcontents.add/
调用示例(JAVA)
复制全部代码
import com.suning.api.entity.sngoods.productcontentsAddRequest; import com.suning.api.entity.sngoods.productcontentsAddResponse; productcontentsAddRequest request = new productcontentsAddRequest(); request.setAlertQty("5"); ChildItem childItem= new ChildItem(); childItem.setAlertQty("5"); childItem.setInvQty("5"); childItem.setItemCode("561"); childItem.setPrice("100.00"); childItem.setSuggestedRetailPrice("100"); childItem.setProductCode("104007723"); childItem.setSupplierImg1Url("http://1.jpg"); List
childItemList =new ArrayList
(); childItemList.add(childItem); request.setChildItem(childItemList); request.setCmTitle("商品标题"); DetailModule detailModule= new DetailModule(); detailModule.setContent("5aW95ZWG5ZOB"); detailModule.setModuleId("1"); detailModule.setModuleName("售后服务"); detailModule.setNum("1"); detailModule.setType("usr_mod"); List
detailModuleList =new ArrayList
(); detailModuleList.add(detailModule); request.setDetailModule(detailModuleList); request.setHighlightWordone("123"); request.setHighlightWordthree("亮点词3"); request.setHighlightWordtwo("亮点词2"); request.setImgUrl("http://1.jpg"); request.setIntroduction("5aW95ZWG5ZOB"); request.setInvQty("10"); request.setItemCode("789123"); request.setMinNum("111"); request.setPrice("5.00"); request.setSuggestedRetailPrice("100.00"); request.setPrivateFlag("1:私密商品 0:普通商品"); request.setProductCode("102652866"); request.setSaleDate("2013-09-15"); request.setSaleSet("0"); request.setSellPoint("商品卖点"); request.setSourceCountry("CN"); request.setSupplierImg10Url("http://1.jpg..."); request.setSupplierImg1Url("http://1.jpg..."); request.setSupplierImg2Url("http://1.jpg..."); request.setSupplierImg3Url("http://1.jpg..."); request.setSupplierImg4Url("http://1.jpg..."); request.setSupplierImg5Url("http://1.jpg..."); request.setSupplierImg6Url("http://1.jpg..."); request.setSupplierImg7Url("http://1.jpg..."); request.setSupplierImg8Url("http://1.jpg..."); request.setSupplierImg9Url("http://1.jpg..."); //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 { productcontentsAddResponse response = client.excute(request); System.out.println("返回json/xml格式数据 :" + response.getBody()); } catch (SuningApiException e) { e.printStackTrace(); }
调用示例(PHP)
复制全部代码
$req = new productcontentsAddRequest(); $req -> setAlertQty("5"); $childItem= new ChildItem(); $childItem-> setAlertQty("5"); $childItem-> setInvQty("5"); $childItem-> setItemCode("561"); $childItem-> setPrice("100.00"); $childItem-> setSuggestedRetailPrice("100"); $childItem-> setProductCode("104007723"); $childItem-> setSupplierImg1Url("http://1.jpg"); $req -> setChildItem(array($childItem)); $req -> setCmTitle("商品标题"); $detailModule= new DetailModule(); $detailModule-> setContent("5aW95ZWG5ZOB"); $detailModule-> setModuleId("1"); $detailModule-> setModuleName("售后服务"); $detailModule-> setNum("1"); $detailModule-> setType("usr_mod"); $req -> setDetailModule(array($detailModule)); $req -> setHighlightWordone("123"); $req -> setHighlightWordthree("亮点词3"); $req -> setHighlightWordtwo("亮点词2"); $req -> setImgUrl("http://1.jpg"); $req -> setIntroduction("5aW95ZWG5ZOB"); $req -> setInvQty("10"); $req -> setItemCode("789123"); $req -> setMinNum("111"); $req -> setPrice("5.00"); $req -> setSuggestedRetailPrice("100.00"); $req -> setPrivateFlag("1:私密商品 0:普通商品"); $req -> setProductCode("102652866"); $req -> setSaleDate("2013-09-15"); $req -> setSaleSet("0"); $req -> setSellPoint("商品卖点"); $req -> setSourceCountry("CN"); $req -> setSupplierImg10Url("http://1.jpg..."); $req -> setSupplierImg1Url("http://1.jpg..."); $req -> setSupplierImg2Url("http://1.jpg..."); $req -> setSupplierImg3Url("http://1.jpg..."); $req -> setSupplierImg4Url("http://1.jpg..."); $req -> setSupplierImg5Url("http://1.jpg..."); $req -> setSupplierImg6Url("http://1.jpg..."); $req -> setSupplierImg7Url("http://1.jpg..."); $req -> setSupplierImg8Url("http://1.jpg..."); $req -> setSupplierImg9Url("http://1.jpg..."); //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.CustomSngoodsRequest; using suning_api_sdk.BizResponse.CustomSngoodsResponse; using suning_api_sdk.Models.CustomSngoodsModel; productcontentsAddRequest request = new productcontentsAddRequest(); request.alertQty="5"; productcontentsAddChildItemReq childItem= new productcontentsAddChildItemReq(); childItem.alertQty="5"; childItem.invQty="5"; childItem.itemCode="561"; childItem.price="100.00"; childItem.suggestedRetailPrice="100"; childItem.productCode="104007723"; childItem.supplierImg1Url="http://1.jpg"; List
childItemList =new ArrayList
(); childItemList.add(childItem); request.childItem=childItemList; request.cmTitle="商品标题"; productcontentsAddDetailModuleReq detailModule= new productcontentsAddDetailModuleReq(); detailModule.content="5aW95ZWG5ZOB"; detailModule.moduleId="1"; detailModule.moduleName="售后服务"; detailModule.num="1"; detailModule.type="usr_mod"; List
detailModuleList =new ArrayList
(); detailModuleList.add(detailModule); request.detailModule=detailModuleList; request.highlightWordone="123"; request.highlightWordthree="亮点词3"; request.highlightWordtwo="亮点词2"; request.imgUrl="http://1.jpg"; request.introduction="5aW95ZWG5ZOB"; request.invQty="10"; request.itemCode="789123"; request.minNum="111"; request.price="5.00"; request.suggestedRetailPrice="100.00"; request.privateFlag="1:私密商品 0:普通商品"; request.productCode="102652866"; request.saleDate="2013-09-15"; request.saleSet="0"; request.sellPoint="商品卖点"; request.sourceCountry="CN"; request.supplierImg10Url="http://1.jpg..."; request.supplierImg1Url="http://1.jpg..."; request.supplierImg2Url="http://1.jpg..."; request.supplierImg3Url="http://1.jpg..."; request.supplierImg4Url="http://1.jpg..."; request.supplierImg5Url="http://1.jpg..."; request.supplierImg6Url="http://1.jpg..."; request.supplierImg7Url="http://1.jpg..."; request.supplierImg8Url="http://1.jpg..."; request.supplierImg9Url="http://1.jpg..."; //开启日志调试,当测试稳定之后建议设置为 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); productcontentsAddResponse response = client.Execute(request);
调用示例(PYTHON)
复制全部代码
# -*- coding: utf-8 -*- import suning.api request = suning.api.sngoods.productcontentsAddRequest() request.alertQty="5"; request. childItem= [{ alertQty:"5", invQty:"5", itemCode:"561", price:"100.00", suggestedRetailPrice:"100", productCode:"104007723", supplierImg1Url:"http://1.jpg", }]; request.cmTitle="商品标题"; request. detailModule= [{ content:"5aW95ZWG5ZOB", moduleId:"1", moduleName:"售后服务", num:"1", type:"usr_mod", }]; request.highlightWordone="123"; request.highlightWordthree="亮点词3"; request.highlightWordtwo="亮点词2"; request.imgUrl="http://1.jpg"; request.introduction="5aW95ZWG5ZOB"; request.invQty="10"; request.itemCode="789123"; request.minNum="111"; request.price="5.00"; request.suggestedRetailPrice="100.00"; request.privateFlag="1:私密商品 0:普通商品"; request.productCode="102652866"; request.saleDate="2013-09-15"; request.saleSet="0"; request.sellPoint="商品卖点"; request.sourceCountry="CN"; request.supplierImg10Url="http://1.jpg..."; request.supplierImg1Url="http://1.jpg..."; request.supplierImg2Url="http://1.jpg..."; request.supplierImg3Url="http://1.jpg..."; request.supplierImg4Url="http://1.jpg..."; request.supplierImg5Url="http://1.jpg..."; request.supplierImg6Url="http://1.jpg..."; request.supplierImg7Url="http://1.jpg..."; request.supplierImg8Url="http://1.jpg..."; request.supplierImg9Url="http://1.jpg..."; 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)