登录
退出
首页
开放版图
苏宁有货
商家后台
文档中心
文档中心
API文档
消息中心
平台公告
工单
我的工单
提交工单
控制台
SDK调用示例
suning.custom.ordercoupon.add/
调用示例(JAVA)
复制全部代码
import com.suning.api.entity.custom.OrderCouponAddRequest; import com.suning.api.entity.custom.OrderCouponAddResponse; OrderCouponAddRequest request = new OrderCouponAddRequest(); request.setActivityName("0元购"); request.setStartTime("2015-06-18 00:00:00"); request.setEndTime("2015-07-18 00:00:00"); request.setChannelInfo("1,2"); request.setActivityProductType("1"); request.setCouponProductType("1"); request.setReturnCouponType("1"); request.setReturnCouponValue("10000"); request.setActivityLimit("1"); request.setActivityTimesLimit("100"); request.setPeopleActivityTimesLimit("10"); request.setEffectDays("30"); request.setBaseQuantifierType("1"); request.setRewardType("1"); request.setAreaCode("0012"); request.setBooleanCap("1"); request.setFloor("1"); request.setDiscountValue("100"); request.setRewardAmount("5"); request.setBaseAmount("100"); request.setDiscountThreshold("2"); request.setCutAmount("20"); request.setReduceLimit("2"); request.setCouponProductCode("100021342"); request.setActivityProductCode("100021342"); //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 { OrderCouponAddResponse response = client.excute(request); System.out.println("返回json/xml格式数据 :" + response.getBody()); } catch (SuningApiException e) { e.printStackTrace(); }
调用示例(PHP)
复制全部代码
$req = new OrderCouponAddRequest(); $req -> setActivityName("0元购"); $req -> setStartTime("2015-06-18 00:00:00"); $req -> setEndTime("2015-07-18 00:00:00"); $req -> setChannelInfo("1,2"); $req -> setActivityProductType("1"); $req -> setCouponProductType("1"); $req -> setReturnCouponType("1"); $req -> setReturnCouponValue("10000"); $req -> setActivityLimit("1"); $req -> setActivityTimesLimit("100"); $req -> setPeopleActivityTimesLimit("10"); $req -> setEffectDays("30"); $req -> setBaseQuantifierType("1"); $req -> setRewardType("1"); $req -> setAreaCode("0012"); $req -> setBooleanCap("1"); $req -> setFloor("1"); $req -> setDiscountValue("100"); $req -> setRewardAmount("5"); $req -> setBaseAmount("100"); $req -> setDiscountThreshold("2"); $req -> setCutAmount("20"); $req -> setReduceLimit("2"); $req -> setCouponProductCode("100021342"); $req -> setActivityProductCode("100021342"); //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.CustomCustomRequest; using suning_api_sdk.BizResponse.CustomCustomResponse; using suning_api_sdk.Models.CustomCustomModel; OrderCouponAddRequest request = new OrderCouponAddRequest(); request.activityName="0元购"; request.startTime="2015-06-18 00:00:00"; request.endTime="2015-07-18 00:00:00"; request.channelInfo="1,2"; request.activityProductType="1"; request.couponProductType="1"; request.returnCouponType="1"; request.returnCouponValue="10000"; request.activityLimit="1"; request.activityTimesLimit="100"; request.peopleActivityTimesLimit="10"; request.effectDays="30"; request.baseQuantifierType="1"; request.rewardType="1"; request.areaCode="0012"; request.booleanCap="1"; request.floor="1"; request.discountValue="100"; request.rewardAmount="5"; request.baseAmount="100"; request.discountThreshold="2"; request.cutAmount="20"; request.reduceLimit="2"; request.couponProductCode="100021342"; request.activityProductCode="100021342"; //开启日志调试,当测试稳定之后建议设置为 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); OrderCouponAddResponse response = client.Execute(request);
调用示例(PYTHON)
复制全部代码
# -*- coding: utf-8 -*- import suning.api request = suning.api.custom.OrderCouponAddRequest() request.activityName="0元购" request.startTime="2015-06-18 00:00:00" request.endTime="2015-07-18 00:00:00" request.channelInfo="1,2" request.activityProductType="1" request.couponProductType="1" request.returnCouponType="1" request.returnCouponValue="10000" request.activityLimit="1" request.activityTimesLimit="100" request.peopleActivityTimesLimit="10" request.effectDays="30" request.baseQuantifierType="1" request.rewardType="1" request.areaCode="0012" request.booleanCap="1" request.floor="1" request.discountValue="100" request.rewardAmount="5" request.baseAmount="100" request.discountThreshold="2" request.cutAmount="20" request.reduceLimit="2" request.couponProductCode="100021342" request.activityProductCode="100021342" 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)