gpt4 book ai didi

vba - 来自 Excel VBA RingCentral FaxoutAPI 的 HTTP 发布

转载 作者:行者123 更新时间:2023-12-04 21:05:23 25 4
gpt4 key购买 nike

我需要帮助才能使此代码正常工作。我对 VBA 编程以及与 HTTP Post 和表单相关的任何内容都是全新的。我已尝试通过阅读此处的问题并遵循 API 帮助来尽一切努力使其正常工作,但似乎没有任何效果。

这是您可以找到 API 引用的网站:
http://service.ringcentral.com/faxoutapi/

这也是我到目前为止的代码:

Sub POST()
Dim WinHttpReq As Object
Set WinHttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")
Dim strURL As String
Dim PostData As String
strURL = "https://service.ringcentral.com/faxapi.asp"
Const Boundary As String = "---------------------------7d54b1fee05aa"
WinHttpReq.Open "POST", strURL, False

WinHttpReq.setRequestHeader "Content-Type", "multipart/form-data; boundary=" & Boundary

PostData = "--" & Boundary & vbCrLf
PostData = PostData & "Content-Disposition: form-data; name=""Username""" & vbCrLf
PostData = PostData & "username" & vbCrLf
PostData = PostData & "--" & Boundary & vbCrLf
PostData = PostData & "Content-Disposition: form-data; name=""Password""" & vbCrLf
PostData = PostData & "password" & vbCrLf
PostData = PostData & "--" & Boundary & vbCrLf
PostData = PostData & "Content-Disposition: form-data; name=""Recipient""" & vbCrLf
PostData = PostData & "faxnumber" & vbCrLf
PostData = PostData & "--" & Boundary & vbCrLf
PostData = PostData & "Content-Disposition: form-data; name=""Coverpagetext""" & vbCrLf
PostData = PostData & "This is a test fax from web" & vbCrLf
PostData = PostData & "--" & Boundary & vbCrLf

WinHttpReq.Send (PostData)
MsgBox WinHttpReq.ResponseText

End Sub

我不断收到 5 的响应值,这意味着一般错误。我很确定表格与正确的格式不匹配。我还希望能够上传 API 引用中所示的文件。

提前致谢

最佳答案

FaxOut.asp API 端点已于 2018 年 8 月 9 日终止。
在此处的注意事项中查看更多信息:
https://support.ringcentral.com/article/Legacy-API-End-of-Life-Announcement-RingOut-asp-FaxOut-asp.html
在以下位置使用新端点:https://platform.devtest.ringcentral.com/restapi/v1.0/account/{accountId}/extension/{extensionId}/fax https://developers.ringcentral.com/api-reference/Fax/createFaxMessage

关于vba - 来自 Excel VBA RingCentral FaxoutAPI 的 HTTP 发布,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22480991/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com