HTTP Post from Excel VBA RingCentral FaxoutAPI -
i need getting code work. i'm new @ programming in vba related http post , forms. i've tried make work reading questions here , following api nothing seems work.
here website can find api reference: http://service.ringcentral.com/faxoutapi/
also here code have far:
sub post() dim winhttpreq object set winhttpreq = createobject("winhttp.winhttprequest.5.1") dim strurl string dim postdata string strurl = "https://service.ringcentral.com/faxapi.asp" const boundary 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 test fax web" & vbcrlf postdata = postdata & "--" & boundary & vbcrlf winhttpreq.send (postdata) msgbox winhttpreq.responsetext end sub i keep getting response value of 5 means generic error. i'm pretty sure form doesn't match correct format. able upload file shown in api's reference.
thanks in advance
Comments
Post a Comment