Foxtable(狐表)用户栏目专家坐堂 → API调用实例问题


  共有2357人关注过本帖树形打印复制链接

主题:API调用实例问题

帅哥哟,离线,有人找我吗?
jackchan120925
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:288 积分:2404 威望:0 精华:0 注册:2017/6/19 23:37:00
API调用实例问题  发帖心情 Post By:2019/4/27 16:39:00 [只看该作者]

请教老师:针对以下接口说明,我写了如下调用代码,但是显示参数错误,不知问题出在哪里

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: DAD3BBF2098B4F1B9F85B66523254F78

1.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

}

字段详解:

参数名

参数说明

是否必填

loginName

传入的登陆账号 [W开头]

必填[W开头]

appkey

Token

必填

page

页码

必填

pagesize

每页数量

必填(每页最多200

startTime

检索区间:开始时间(yyyy-MM-dd)

(yyyy-MM-dd HH:mm:ss)

选填

endTime

检索区间:结束时间

(yyyy-MM-dd)

(yyyy-MM-dd HH:mm:ss)

选填

dealState

订单状态:

1 - 待支付
2 - 待出库
3 - 已出库
5 - 待评论
6 - 已完成
7 - 已取消

选填

注:“取消待审核”状态可使用查询取消待审核列表接口进行获取

timeParamType

时间参数类型:

<!--[if !supportLists]-->1-  <!--[endif]-->下单时间,

<!--[if !supportLists]-->2-  <!--[endif]-->更新时间

选填(默认下单时间)

注:timeParamType2时,startTimeendTime都不设置时,timeParamType只做排序使用。

 

返回参数:根据code判断是否成功,msg是失败信息

       {

    "msg": "商家订单列表查询成功",

    "data": [

        {

            "DealTotalFee": 1,//订单总金额

            "DealTotalPayment": 1,//实际支付金额

            "DealType": 3,// 订单类型:

1 - 普通商品订单

2 - 游乐商品订单

3 - 跨境购商品订单

4 - 闪购商品订单

5 - 预售商品订单

6 - piao务商品订单

            "PaySuccessTime": 0,// 支付时间

"LastUpdateTime ": 1533811987,// 最后更新时间

            "DealState": 7,// 订单状态

            "RecvName": "23",// 收货人

            "dealCode": "30470163624",// 发货订单号

            "DealGenTime": 1461052865// 下单时间

        },

        {
            
"DealTotalFee":"1",
            
"DealTotalPayment":101,
            
"DealType":1,
            
"PaySuccessTime":1533281104,
            
"LastUpdateTime":1533808870,
            
"DealState":7,
            
"RecvName":"陈虎",
            
"dealCode":"109801272215",
            
"DealGenTime":1533281087
        }

    ],

    "success": "成功",

"errorCode": "205",

"totalNum": "1000"

}

错误结果如下:

Errorcode

msg

success

206

商家订单列表查询失败

失败

204

参数为空

失败

203

获取商家信息失败

失败






 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:107861 积分:548662 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By: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
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:288 积分:2404 威望:0 精华:0 注册:2017/6/19 23:37:00
  发帖心情 Post By: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()
---------------------------
确定   
---------------------------


 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:107861 积分:548662 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By: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
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:288 积分:2404 威望:0 精华:0 注册:2017/6/19 23:37:00
  发帖心情 Post By:2019/4/27 20:24:00 [只看该作者]

测试还是显示
{"errorCode":"200","msg":"参数不能为空","success":"失败"}

我看说明文档里面好像错误编码没有200的,是文档有误吗?我是我理解有误。

帮忙看下哈。


还有在说明文档里面
  1. 测试请求
  2. 线上IP
这俩个地址分别是指什么呀?

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By: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
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:288 积分:2404 威望:0 精华:0 注册:2017/6/19 23:37:00
  发帖心情 Post By:2019/4/28 17:10:00 [只看该作者]

谢谢, 请问下,说明文档里为啥提供二个地址
  1. 测试请求
  2. 线上IP
线上IP是指实际使用的地址吗?

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  8楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2019/4/28 17:12:00 [只看该作者]

测试请求:用来测试的;

 

线上ip:用来正式使用的。


 回到顶部