Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共6 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:调用GET接口,传同样的参数,apipost能正常返回,狐表报错

1楼
wudishaoshuai 发表于:2024/10/25 11:59:00
Dim st As New Date(1970, 1, 1, 8, 0, 0)
Dim timestamp As Long = (Date.Now - st).Totalseconds() * 1000
Dim Secret As String
Dim appSecret As String
Dim xyz As String

Dim myEncoder1 As New System.Text.UTF8Encoding
Dim myHMACSHA2561 As New System.Security.Cryptography.HMACSHA256(myEncoder1.getBytes("fe1dc7cc04f71a67656eb1cf7c64e10a87660a10"))
Dim hashSign1() As Byte = myHMACSHA2561.ComputeHash(myEncoder1.getBytes("xZh4CZ8o"))
Dim b1 As Byte() = System.Text.Encoding.UTF8.GetBytes(BitConverter.ToString(hashSign1).replace("-", "").ToLower())
Secret = Convert.ToBase64String(b1)
appSecret = PercentEncode(Secret)
appSecret = PercentEncode(appSecret)

Dim secretKey As String = "4d6fead97c45340dcf37ef98a6341c8e" '''私钥
Dim signStr As String = "GET" & Chr(10) & "%2Fjdyconnector%2Fapp_management%2Fkingdee_auth_token" & Chr(10) & "app_key=xZh4CZ8o&" & "app_signature=" & appSecret & Chr(10) & "x-api-nonce:" & timestamp & Chr(10) & "x-api-timestamp:" & timestamp & Chr(10)
Dim myEncoder As New System.Text.UTF8Encoding
Dim myHMACSHA256 As New System.Security.Cryptography.HMACSHA256(myEncoder.getBytes(secretKey))
Dim hashSign() As Byte = myHMACSHA256.ComputeHash(myEncoder.getBytes(signStr))
Dim b As Byte() = System.Text.Encoding.UTF8.GetBytes(BitConverter.ToString(hashSign).replace("-", "").ToLower())
Dim base64 = Convert.ToBase64String(b)

Dim hc As New HttpClient("https://api.kingdee.com/jdyconnector/app_management/kingdee_auth_token?app_key=xZh4CZ8o&app_signature=MGU1ZGQzZjFjYWU5NDg4Nzg1Y2RmYmViMjUyYjhjNDZjNTk3ZTEyNWM1NGE1N2M3MzAxZjI2MmQ0ZGUyOGQzYg==")
'hc.Method = "GET"
hc.Headers.Add("X-Api-ClientID", "***")
hc.Headers.Add("X-Api-Auth-Version", "2.0")
hc.Headers.Add("X-Api-TimeStamp", timestamp)
hc.Headers.Add("X-Api-SignHeaders", "X-Api-TimeStamp,X-Api-Nonce")
hc.Headers.Add("X-Api-Nonce", timestamp)
hc.Headers.Add("X-Api-Signature", base64)

Output.Show("timestamp=" & timestamp)
Output.Show("Secret=" & Secret)
Output.Show("base64=" & base64)

Output.Show(hc.GetData)
2楼
有点蓝 发表于:2024/10/25 12:03:00
报什么错?接口文档发上来看看
3楼
wudishaoshuai 发表于:2024/10/25 13:40:00
小微生态门户-文档详情接口文档是这个,报519错,但是狐表只能看到200返回的提示,所以具体报什么错不清楚
4楼
wudishaoshuai 发表于:2024/10/25 14:03:00
或者狐表考虑升级一下这个地方吗,可以接收除200以外的提示
5楼
有点蓝 发表于:2024/10/25 14:06:00
app_signature里的内容要进行urlencode处理

Dim hc As New HttpClient("https://api.kingdee.com/jdyconnector/app_management/kingdee_auth_token?app_key=xZh4CZ8o&app_signature=MGU1ZGQzZjFjYWU5NDg4Nzg1Y2RmYmViMjUyYjhjNDZjNTk3ZTEyNWM1NGE1N2M3MzAxZjI2MmQ0ZGUyOGQzYg%3D%3D")
'hc.Method = "GET"
hc.ContentType = "application/json"
hc.Headers.Add("Content-Type", "application/json")
hc.Headers.Add("X-Api-ClientID", "***")
6楼
wudishaoshuai 发表于:2024/10/25 14:21:00
咦,我用apipost的时候没报错,看来是直接帮我转义了,感谢蓝版
共6 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .02899 s, 2 queries.