question

jason4335 avatar image
jason4335 asked John Wang answered

Fax API Call Help

Body:


{ "message" : "Unsupported Media Type", "errors" : [ ] }


Header:


X-Rate-Limit-Window : 60

Status_Code : 415

RoutingKey : SJC11P01PAS01

Http_Version : HTTP/1.1

Explanation : Unsupported Media Type

Connection : close

Content-Language : en-US

Date : Sun, 18 Mar 2018 02:55:08 GMT

X-Rate-Limit-Group : heavy

Server : nginx/1.10.2

RCRequestId : c479c8b0-2a57-11e8-a5f0-005056bb594d

Content-Type : application/json;charset=UTF-8

X-Rate-Limit-Limit : 10

X-Rate-Limit-Remaining : 9

Content-Length : 60


Code:


To decipher Coldfusion, I am telling it to submit a multi-part form encoded in UTF-8. I know most of you don't know Coldfusion, but you can see my variables below...do I even have the correct variables here?


<cfhttp method="post"

url="#final_url#"

multipart="yes"

resolveurl="no"

charset="utf-8"

name="faxes"


>


<cfhttpparam type="header" name="authorization" value="#authorization#">

<cfhttpparam type="header" name="content-type" value="text/plain">


<cfhttpparam type="formField" name="to" value="#ringcentralFax.toFaxNumber#">

<cfhttpparam type="formField" name="faxResolution" value="#ringcentralFax.faxResolution#">

<cfhttpparam type="formField" name="attachment" value="#faxFileName#">


<cfhttpparam type="file" name="#faxFileName#" file="#faxFilePath#">



</cfhttp>


rest apifax
1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

John Wang avatar image
John Wang answered
I haven't used Cold Fusion but the following content type looks incorrect:

<cfhttpparam type="header" name="content-type" value="text/plain">

The HTTP request header should be "mutipart/form-data" instead of "text/plain".

To spot check your entire request, you should inspect the HTTP request headers and body that is constructed. You can dump this yourself or send it to a service like RequestBin ( https://requestb.in/).

Your HTTP request should look something like the example in the Developer Guide:

http://ringcentral-api-docs.readthedocs.io/en/latest/messages_faxes/

1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys