登录
退出
首页
开放版图
苏宁有货
商家后台
文档中心
文档中心
API文档
消息中心
平台公告
工单
我的工单
提交工单
控制台
SDK调用示例
suning.asmp.sninstallorder.add/
调用示例(JAVA)
复制全部代码
package com.suning.api.custom.asmp; import com.suning.api.entity.asmp.SnInstallOrderAddRequest.*; import com.suning.api.entity.asmp.SnInstallOrderAddRequest; import com.suning.api.client.Client; import com.suning.api.DefaultSuningClient; import java.util.ArrayList; import java.util.List; import com.suning.api.exception.SuningApiException; import com.suning.api.SuningResponse; public class SnInstallOrderAddTest{ public static void main(String[]args){ //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"); SnInstallOrderAddRequest request = new SnInstallOrderAddRequest(); request.setRecordGuid("5D21BD501D63793FE1000000C0A8765D"); request.setItemGuid("4FA025393D23C08CE1008000C0A8765B"); request.setSrvOrdId("7163370425"); request.setSrvOrdType("ZS01"); request.setZb2bFlag("JS"); List
jsDetailList = new ArrayList
(); JsDetail jsDetail = new JsDetail(); jsDetail.setZb2bJsdh("10001023430"); jsDetail.setZb2bJb("100.00"); jsDetail.setZb2bLr("100.00"); jsDetail.setZb2bYc("100.00"); jsDetail.setZb2bJlf("100.00"); jsDetail.setZb2bQt("100.00"); jsDetail.setZb2bKkCode("1"); jsDetail.setZb2bKk("1"); jsDetailList.add(jsDetail); request.setJsDetail(jsDetailList); List
jyDetailList = new ArrayList
(); JyDetail jyDetail = new JyDetail(); jyDetail.setZb2bJyCode("103430134"); jyDetail.setZb2bJyDis("XXé误"); jyDetailList.add(jyDetail); request.setJyDetail(jyDetailList); try { request.setCheckParam(true); SuningResponse resp = client.excute(request); System.out.println("request: " + resp.getReqParam()); System.out.println("response: " + resp.getBody()); } catch (SuningApiException e) { e.printStackTrace(); } } }
调用示例(PHP)
复制全部代码
require_once(dirname(__FILE__).'/../../SuningSdk.php'); require_once(dirname(__FILE__).'/../../DefaultSuningClient.php'); require_once(dirname(__FILE__).'/../../request/asmp/SnInstallOrderAddRequest.php'); $req = new SnInstallOrderAddRequest(); $req->setRecordGuid("5D21BD501D63793FE1000000C0A8765D"); $req->setItemGuid("4FA025393D23C08CE1008000C0A8765B"); $req->setSrvOrdId("7163370425"); $req->setSrvOrdType("ZS01"); $req->setZb2bFlag("JS"); $jsDetail = new JsDetail(); $jsDetail->setZb2bJsdh("10001023430"); $jsDetail->setZb2bJb("100.00"); $jsDetail->setZb2bLr("100.00"); $jsDetail->setZb2bYc("100.00"); $jsDetail->setZb2bJlf("100.00"); $jsDetail->setZb2bQt("100.00"); $jsDetail->setZb2bKkCode("1"); $jsDetail->setZb2bKk("1"); $req->setJsDetail(array($jsDetail)); $jyDetail = new JyDetail(); $jyDetail->setZb2bJyCode("103430134"); $jyDetail->setZb2bJyDis("XXé误"); $req->setJyDetail(array($jyDetail)); //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 System; using System.Text; using System.Collections.Generic; using System.Linq; using suning_api_sdk.Logger; using suning_api_sdk; using suning_api_sdk.BizRequest.CustomAsmpRequest; using suning_api_sdk.Models.CustomAsmpModel; using suning_api_sdk.BizResponse.CustomAsmpResponse; using System.Diagnostics; namespace suning_api_sdk_test.CustomAsmpTest { public class SnInstallOrderAddTest { public static void Main(string[] args) { //开启日志调试,当测试稳定之后建议设置为 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); SnInstallOrderAddRequest request = new SnInstallOrderAddRequest(); request.recordGuid = "5D21BD501D63793FE1000000C0A8765D"; request.itemGuid = "4FA025393D23C08CE1008000C0A8765B"; request.srvOrdId = "7163370425"; request.srvOrdType = "ZS01"; request.zb2bFlag = "JS"; List
jsDetailList = new List
(); SnInstallOrderAddJsDetailReq jsDetail = new SnInstallOrderAddJsDetailReq(); jsDetail.zb2bJsdh = "10001023430"; jsDetail.zb2bJb = "100.00"; jsDetail.zb2bLr = "100.00"; jsDetail.zb2bYc = "100.00"; jsDetail.zb2bJlf = "100.00"; jsDetail.zb2bQt = "100.00"; jsDetail.zb2bKkCode = "1"; jsDetail.zb2bKk = "1"; jsDetailList.Add(jsDetail); request.jsDetail = jsDetailList; List
jyDetailList = new List
(); SnInstallOrderAddJyDetailReq jyDetail = new SnInstallOrderAddJyDetailReq(); jyDetail.zb2bJyCode = "103430134"; jyDetail.zb2bJyDis = "XXé误"; jyDetailList.Add(jyDetail); request.jyDetail = jyDetailList; Console.WriteLine("请求报文:" + request.ToJson()); SnInstallOrderAddResponse nqresp = snClient.Execute(request); if(null != nqresp){ if (nqresp.respError != null) { Console.WriteLine(nqresp.respError.error_code); } else { Console.WriteLine("返回报文:" + nqresp.ToJson()); } } } } }
调用示例(PYTHON)
复制全部代码
import suning.api request = suning.api.SnInstallOrderAddRequest() request.recordGuid="5D21BD501D63793FE1000000C0A8765D" request.itemGuid="4FA025393D23C08CE1008000C0A8765B" request.srvOrdId="7163370425" request.srvOrdType="ZS01" request.zb2bFlag="JS" request.zb2bJsdh="10001023430" request.zb2bJb="100.00" request.zb2bLr="10.00" request.zb2bYc="20.00" request.zb2bJlf="10.00" request.zb2bQt="3.00" request.zb2bKkCode="1" request.zb2bKk="1" request.zb2bJyCode="103430134" request.zb2bJyDis="XX错误" 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)