Question

Fax API Call Help

  • 18 March 2018
  • 1 reply
  • 358 views

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>



1 reply

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/

Reply