Skip to main content
torstenp33246615
Participant
January 22, 2020
Question

ColdFusion 2016 Rest API to SCOUT - Content-Type: application/vnd.api+json

  • January 22, 2020
  • 1 reply
  • 1205 views

I am attempting to run a simple REST api with ColdFusion and receiving same error regardless of attempt. The call works fine in Postman with the 4 params. But cant recreate in ColdFusion 2016 CFHTTP.

<cfhttp url="https://api.sandbox.scoutrfp.com/v3/contracts" method="GET" result="ITEM_INFO">

        <cfhttpparam type="header" name="X-Api-Key" value="#variables.API_KEY#">

        <cfhttpparam type="header" name="X-User-Token" value="#variables.USER_TOKEN#">

        <cfhttpparam type="header" name="Content-Type" value="application/vnd.api+json">

        <cfhttpparam type="header" name="X-User-Email" value="#variables.USER_EMAIL#">

</cfhttp>

I have replaced the header with type cgi as

<cfhttpparam type="CGI" encoded="false" name="Content_Type" value="application/vnd.api+json">

I have added all temp headers that postman sends.

Always same error: Missing or incorrect Content-Type header for JSON:API: Expected request to include 'Content-Type: application/vnd.api+json

Seems CFHTTP tag not properly sending value "application/vnd.api+json" - perhaps encoding it incorrectly in some fashion? Is there another means to send this Content-Type via CFHTTP to get a response?

This topic has been closed for replies.

1 reply

BKBK
Community Expert
Community Expert
January 27, 2020

Two tips:

 

1) method="POST"

 

2) Any luck with this?

<cfhttpparam type="header" name="Content-Type" value="application/vnd#chr(46)#api#chr(43)#json">

 

Or this?

<cfhttpparam type="header" name="Content-Type" value="application/vnd#chr(46)#api#chr(43)#json;charset=UTF-8">

torstenp33246615
Participant
January 27, 2020

appreciate the reply...but neither of those worked.

BKBK
Community Expert
Community Expert
January 27, 2020

Our posts crossed. I was still editing mine.

What happens when you switch to "POST" method?