【发布时间】:2019-02-21 21:39:24
【问题描述】:
Public Function GETSHEET(sID As String, xTOK As String) As WebResponse
Dim sSHEET As New WebClient
Dim xD As New Dictionary
Dim xR As WebResponse
Dim xNC As New Collection
sSHEET.BaseUrl = "https://api.smartsheet.com/2.0/sheets/"
Set xR = sSHEET.GetJson(sID)
xNC.Add WebHelpers.CreateKeyValue("Authorization", "Bearer " & xTOK)
xD.Add "Headers", Headers
Set xR = sSHEET.GetJson(sID, xD)
If xR.StatusCode = WebStatusCode.Ok Then
Set GETSHEET = xR
Else
bR = MsgBox("Error!" & Chr(10) & _
"Status Code : " & xR.StatusCode & Chr(10) & _
"Code Description : " & xR.StatusDescription & Chr(10) & _
"Content : " & xR.Content, vbCritical, "Error!")
Debug.Print "Error!"
Debug.Print xR.StatusCode
Debug.Print xR.StatusDescription
Debug.Print xR.Content
End
End If
End Function
所以,我得到了响应状态代码:404 错误代码:1006 - 未找到,但令牌正常,并且在函数中给出了工作表的 ID。为什么找不到工作表?
【问题讨论】:
-
您正在使用哪个附加库,其中一个成员具有 .GetJson 等方法?
-
vba-web by TimhallL github.com/VBA-tools/VBA-Web
-
啊,是的。很久以前玩过。
-
@QHarr,我做错了什么?
-
您是否尝试过使用 Postman 之类的工具进行测试?恐怕我无法真正帮助解决这个问题,因为我没有帐户,也不确定预期的最终结果是什么。