以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- API调用实例问题 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=134102) |
|||||||||||||||||||||||||||||||||||||||
-- 作者:jackchan120925 -- 发布时间:2019/4/27 16:39:00 -- API调用实例问题 请教老师:针对以下接口说明,我写了如下调用代码,但是显示参数错误,不知问题出在哪里Dim hc As new HttpClient("http://orderprocesstest.haiziwang.com:8080/dap-web/pop/selectBusinessOrderList.Do") hc.Formdata.add("loginName", "w1000125") hc.Formdata.add("appkey", "DAD3BBF2098B4F1B9F85B66523254F78") hc.Formdata.add("page", "1") hc.Formdata.add("pagesize", "10") hc.Formdata.add("startTime", "2016-04-19") hc.Formdata.add("endTime", "2016-04-22") hc.Formdata.add("dealState", "3") hc.Formdata.add("timeParamType", "1") Dim ret As String = hc.getdata() output.show(ret) 反馈如下 {"errorCode":"200","msg":"参数不能为空","success":"失败"} -------------------------------------------以下为接口描述----------------------- loginName:w1000125
appkey: DAD3BBF2098B4F1B9F85B66523254F781.1获取列表接口调用方:后端 说明:根据后端入参调用,获取订单列表信息。
根据传入的loginName,appkey查找到sellerID,将sellerID作为参数一起传入,查看订单列表信息。 <!--[endif]-->测试请求: <!--[if !supportLists]-->l <!--[endif]-->http://orderprocesstest.haiziwang.com:8080/dap-web/pop/selectBusinessOrderList.do?jsonStr={"loginName":"xxxxxxxxxxx","appkey":"xxxxxxxxxxxxxxxxxxx","page":
"1", "pagesize":10,"startTime":
"2016-04-19","endTime":
"2016-04-22","dealState": "3",”timeParamType”:1} <!--[if !supportLists]-->l <!--[endif]-->线上IP: <!--[if !supportLists]-->l <!--[endif]-->http://dapopen.haiziwang.com/pop/selectBusinessOrderList.do?jsonStr={"loginName":"xxxxxxx","appkey":"xxxxxxxxxxxxxxxxxxxxx","page":
"1", "pagesize":10,"startTime":
"2016-04-19","endTime":
"2016-04-22","dealState": "3",”timeParamType”:1} <!--[if !supportLists]-->l <!--[endif]-->传入参数:json串 Var jsonStr = { "loginName": "xxxxxxxxxx", "appkey": "xxxxxxxxxxxxxxxxxxxxxxxx", "page": "1", "pagesize":10, "startTime":
"2016-03-01", "endTime":
"2016-03-31", "dealState": "1", "timeParamType": 1 } 字段详解:
返回参数:根据code判断是否成功,msg是失败信息 { "msg": "商家订单列表查询成功", "data": [ { "DealTotalFee": 1,//订单总金额 "DealTotalPayment": 1,//实际支付金额 "DealType": 3,// 订单类型: 1 - 普通商品订单 2 - 游乐商品订单 3 - 跨境购商品订单 4 - 闪购商品订单 5 - 预售商品订单 6 - 票务商品订单 "PaySuccessTime": 0,// 支付时间 "LastUpdateTime ":
1533811987,// 最后更新时间 "DealState": 7,// 订单状态 "RecvName":
"23",// 收货人 "dealCode":
"30470163624",// 发货订单号 "DealGenTime": 1461052865//
下单时间 }, { ], "success": "成功", "errorCode": "205", "totalNum": "1000" } 错误结果如下:
|
|||||||||||||||||||||||||||||||||||||||
-- 作者:有点蓝 -- 发布时间:2019/4/27 17:07:00 -- Dim hc As new HttpClient("http://orderprocesstest.haiziwang.com:8080/dap-web/pop/selectBusinessOrderList.Do") Dim js"loginName"": ""xxxxxxxxxx"", ......拼接json,或者使用jobject生成 hc.Content =jsonStr Dim ret As String = hc.getdata() output.show(ret) |
|||||||||||||||||||||||||||||||||||||||
-- 作者:jackchan120925 -- 发布时间:2019/4/27 17:20:00 -- 您好, Dim js"loginName"": ""xxxxxxxxxx"", ......拼接json,或者使用jobject生成 这个是什么意思? 是根据帮助里面的: Dim json As
String = "{\'name\':\'李云龙\',\'age\':\'36\'}" Dim jo As JObject = JObject.Parse(json) 然后在把 jo赋值给 hc.content 吗? 如此套用后代码如下 Dim hc As new HttpClient("http://orderprocesstest.haiziwang.com:8080/dap-web/pop/selectBusinessOrderList.Do") Dim jstr As String="{\'loginName\':\'w1000125\', \'appkey\': \'DAD3BBF2098B4F1B9F85B66523254F78\', \'page\': \'1\', \'pagesize\': \'10\',\'startTime\': \'2016-04-19\', \'endTime\': \'2016-04-22\', \'dealState\': \'3\', \'timeParamType\': \'1\'}" Dim jo As JObject = JObject.parse(jstr) hc.content=jo Dim ret As String = hc.getdata() output.show(ret) 报错如下 --------------------------- 版本:2019.4.12.1 --------------------------- 代码执行出错,错误信息: System.ArgumentException: Can not convert Object to String. 在 Newtonsoft.Json.Linq.JToken.op_Explicit(JToken value) 在 UserCode.Test() --------------------------- 确定 --------------------------- |
|||||||||||||||||||||||||||||||||||||||
-- 作者:有点蓝 -- 发布时间:2019/4/27 17:43:00 -- Dim hc As new HttpClient("http://orderprocesstest.haiziwang.com:8080/dap-web/pop/selectBusinessOrderList.Do") Dim jstr As String="{\'loginName\':\'w1000125\', \'appkey\': \'DAD3BBF2098B4F1B9F85B66523254F78\', \'page\': \'1\', \'pagesize\': \'10\',\'startTime\': \'2016-04-19\', \'endTime\': \'2016-04-22\', \'dealState\': \'3\', \'timeParamType\': \'1\'}" hc.content=jstr Dim ret As String = hc.getdata() output.show(ret)
|
|||||||||||||||||||||||||||||||||||||||
-- 作者:jackchan120925 -- 发布时间:2019/4/27 20:24:00 -- 测试还是显示 {"errorCode":"200","msg":"参数不能为空","success":"失败"} 我看说明文档里面好像错误编码没有200的,是文档有误吗?我是我理解有误。 帮忙看下哈。 还有在说明文档里面
这俩个地址分别是指什么呀? |
|||||||||||||||||||||||||||||||||||||||
-- 作者:有点甜 -- 发布时间:2019/4/28 10:12:00 -- Dim hc As new HttpClient("http://dapopen.haiziwang.com/pop/selectBusinessOrderList.do") Dim jstr As String="{\'loginName\':\'w1000125\', \'appkey\': \'DAD3BBF2098B4F1B9F85B66523254F78\', \'page\': \'1\', \'pagesize\': \'10\',\'startTime\': \'2016-04-19\', \'endTime\': \'2016-04-22\', \'dealState\': \'3\', \'timeParamType\': \'1\'}" hc.FormData.Add("jsonStr", jstr) Dim ret As String = hc.getdata() output.show(ret) |
|||||||||||||||||||||||||||||||||||||||
-- 作者:jackchan120925 -- 发布时间:2019/4/28 17:10:00 -- 谢谢, 请问下,说明文档里为啥提供二个地址
线上IP是指实际使用的地址吗? |
|||||||||||||||||||||||||||||||||||||||
-- 作者:有点甜 -- 发布时间:2019/4/28 17:12:00 -- 测试请求:用来测试的;
线上ip:用来正式使用的。 |