Question

Get an InvalidParameter error when trying to send a fax through API

  • 8 February 2019
  • 2 replies
  • 1350 views

using this API

restClient.post(      restClient.restApi("v1.0").account("~").extension("~").fax().endpoint(), 

qParam);


with Query parameters

QueryParameter[] qParam = new QueryParameter[3];

QueryParameter p0 = new QueryParameter("attachment", "");

QueryParameter p1 = new QueryParameter("faxResolution", "High");

QueryParameter p2 = new QueryParameter("to", "+14694804418");

qParam[0] = p0;

qParam[1] = p1;

qParam[2] = p2;

The error message is:
com.ringcentral.RestException: HTTP status code: 400

{

"errorCode" : "InvalidParameter",

"message" : "Parameter [] value is invalid",

"errors" : [ {

"errorCode" : "CMN-101",

"message" : "Parameter [] value is invalid",

"parameterName" : ""

} ],

"parameterName" : ""

}


2 replies

Userlevel 1
Hi, 

Here is snippet code to send fax.

var attachment = new Attachment { fileName = "test.jpg", contentType = "image/jpeg", bytes = System.IO.File.ReadAllBytes("test.jpg") };
var attachments = new Attachment[] { attachment };
var body = new {
               to = new CallerInfo[] { new CallerInfo { phoneNumber = RECIPIENT } },
               faxResolution = "High",
               coverPageText = "This is a demo Fax page from C Sharp"
               };
var resp = await rc.Restapi().Account().Extension().Fax().Post(body, attachments); 

Hope this helps!
+ Phong
Userlevel 1
Sorry for misunderstood. I just quick looked at your code and thought that it was C#. 

Here is the example to send a Fax message using the Java SDK.

https://github.com/ringcentral/ringcentral-java/blob/master/src/test/java/com/ringcentral/FaxTest.ja...

+ Phong

Reply