以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]api接口post语法如何转换为FT (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=183681) |
-- 作者:洮沙 -- 发布时间:2022/11/12 18:44:00 -- [求助]api接口post语法如何转换为FT 老师,有如下接口代码不会转FT语言,麻烦帮忙转一下,谢谢! 接口连接:https://www.piaocc.com/path/doc.htm (二维码技术接口) 自己编写的代码: Dim ul As String = "https://api.piaocc.com/rest/v_1/code_check.html" Dim hc As New HttpClient("ul") hc.Headers.Add("content-type", "application/json") hc.Headers.Add("authCode", "6c7f36927ab8eec9ad559a3f21929932") Dim jo As New JObject jo("vCode") = "01,10,062001900111,34645821,264.15,20220315,82545294582625960956,9B34," jo("useCache") = "Y" hc.Content = jo.ToString Dim ret As String = hc.GetData() Output.Show(ret) 错误信息如下: [此贴子已经被作者于2022/11/12 19:56:33编辑过]
|
-- 作者:linyunu1 -- 发布时间:2022/11/12 20:39:00 -- Dim ul As String = "https://api.piaocc.com/rest/v_1/code_check.html" Dim hc As New HttpClient(ul)
|
-- 作者:洮沙 -- 发布时间:2022/11/12 20:52:00 -- 谢谢回复,不行的。还得麻烦蓝版帮忙了! |
-- 作者:teng0731 -- 发布时间:2022/11/13 8:59:00 -- Dim ul As String = "https://api.piaocc.com/rest/v_1/code_check.html" Dim hc As New HttpClient(ul) hc.C hc.Method = "POST" hc.Headers.Add("authCode", "6c7f36927ab8eec9ad559a3f21929932") Dim jo As New JObject jo("vCode") = "01,10,062001900111,34645821,264.15,20220315,82545294582625960956,9B34," jo("useCache") = "Y" hc.Content = jo.ToString Dim ret As String = hc.GetData() Output.Show(ret) 上面显示不全,详见下面的截图
[此贴子已经被作者于2022/11/13 9:00:56编辑过]
|
-- 作者:洮沙 -- 发布时间:2022/11/13 9:14:00 -- 感谢狐友回复,我测试返回: 远程服务器返回错误: (400) 错误的请求。 不知您测试怎么样? [此贴子已经被作者于2022/11/13 9:14:08编辑过]
|
-- 作者:teng0731 -- 发布时间:2022/11/13 10:04:00 -- 你的jo("vCode") = "01,10,062001900111,34645821,264.15,20220315,82545294582625960956,9B34," 最后多了一个逗号 我手上没有ukey,做不了测试
[此贴子已经被作者于2022/11/13 10:06:31编辑过]
|
-- 作者:teng0731 -- 发布时间:2022/11/13 10:04:00 -- 试试这样写看看
[此贴子已经被作者于2022/11/13 10:05:17编辑过]
|
-- 作者:洮沙 -- 发布时间:2022/11/13 10:21:00 -- 我发的全部是真实数据。可以直接测试!还是不行的,麻烦你再测试看一下!谢谢! [此贴子已经被作者于2022/11/13 11:02:45编辑过]
|
-- 作者:teng0731 -- 发布时间:2022/11/13 11:27:00 -- 估计只有找蓝版给看看了 |
-- 作者:洮沙 -- 发布时间:2022/11/13 11:57:00 -- 就是的,呼叫蓝版! 已解决: 代码如下: Dim ul As String = "https://api.piaocc.com/rest/v_1/code_check.html" Dim s As String Dim hc As New HttpClient(Cexp(ul)) \'出问题地方 hc.ContentType = "application/json" ’hc.Method = "POST" \'这一句不能要 hc.Headers.Add("authCode", "6c7f36927ab8eec9ad559a3f21929932") Dim jo As New JObject jo("vCode") = "01,10,062001900111,34645821,264.15,20220315,82545294582625960956,9B34," jo("useCache") = "Y" s = jo.ToString hc.Content = s Output.Show(s) Dim ret As String = hc.GetData() Output.Show(ret) [此贴子已经被作者于2022/11/13 16:54:13编辑过]
|