Hi how are you? I'm trying to use the FaxOut API:
http://service.ringcentral.com/faxoutapi/
That's the whole documentation about the api. Basically I need to send an HTTP POST with some data.
This is my code but I can't manage to make it work, please tell me if there's something I'm not seeing.
string URLAuth = "https://service.ringcentral.com/faxapi.asp";
WebClient webClient = new WebClient();
var formData = new NameValueCollection();
formData["Username"] = "2487955151";
formData["Password"] = "mypassword";
formData["Recipient"] = "12485974888";
formData["Coverpagetext"] = "Some random text";
formData["Resolution"] = "High";
byte[] responseBytes = webClient.UploadValues(URLAuth, "POST", formData);
string resultAuthTicket = Encoding.UTF8.GetString(responseBytes);
webClient.Dispose();
return resultAuthTicket;
Thank you very much!
Your code probably isn't working because
WebClient.UploadValues()
is likely creating and sending a request with the content type set toapplication/x-www-form-urlencoded
while the API requiresmultipart/form-data
.multipart/form-data
is a popular content type when sending files.Here is some working C# code that uses
System.Net.Http
(andSystem.IO
) to send amultipart/form-data
request.You can also use the broader RingCentral Platform API which covers fax and more.