I'm having trouble getting the header param "Authorization" to work correctly using cfhttp and cfhttpparam.
The connection is working fine... I am getting out through our proxy so that's not the issue.
The api documentation states that "Authorization" in the header should be formatted as "Authorization:bearer XXXYYYZZ".
When I try to add the "bearer" with a space after it I get the following error: {"status":3,"errmsg":"Expected object or value"}
When I do not add the prefix "bearer" at all I get the following error: {"status":1,"errmsg":"Invalid \"Authorization\" data in request header"}
I've tried "bearer XXXYYYZZ" and "bearer%20XXXYYYZZ" and "bearer XXXYYYZZ" as well with the same results.
Any ideas? Thanks!
CODE:
<cfhttp
timeout="2000"
url="https://api.surveymonkey.net/v2/surveys/get_survey_list/?api_key=xxxx"
proxyserver="proxy.xxxx.com"
proxyport="8080"
method="post"
result="httpResponse"
charset="utf-8"
throwonerror="Yes">
<cfhttpparam type="header" name="Authorization" value="bearer XXXYYYZZ">
</cfhttp>
<cfdump var="#httpResponse#">
RESPONSE:
Charset UTF-8
ErrorDetail [empty string]
Filecontent {"status":1,"errmsg":"Invalid \"Authorization\" data in request header"}
Header HTTP/1.1 200 OK Access-Control-Expose-Headers: Cache-Control,Content-Language,Content-Type,Expires,Last-Modified,Pragma,Date,Content-Length Content-Type: application/json; charset=UTF-8 Date: Thu, 28 Jan 2016 13:16:11 GMT Server: nginx/1.4.6 (Ubuntu) SM-Request-ID: 251952a7-9d21-470e-807d-9b48adf0892b X-Mashery-Message-ID: 9ebad058-e4e5-4cc9-b9cf-bf33dee9fbc6 X-Mashery-Responder: prod-j-worker-us-west-1b-58.mashery.com X-Plan-QPS-Allotted: 6 X-Plan-QPS-Current: 1 X-Plan-Quota-Allotted: 7000 X-Plan-Quota-Current: 5 X-Plan-Quota-Reset: Friday, January 29, 2016 12:00:00 AM GMT Content-Length: 72 Connection: Close
Mimetype application/json
Responseheader
struct
Access-Control-Expose-Headers Cache-Control,Content-Language,Content-Type,Expires,Last-Modified,Pragma,Date,Content-Length
Connection Close
Content-Length 72
Content-Type application/json; charset=UTF-8
Date Thu, 28 Jan 2016 13:16:11 GMT
Explanation OK
Http_Version HTTP/1.1
SM-Request-ID 251952a7-9d21-470e-807d-9b48adf0892b
Server nginx/1.4.6 (Ubuntu)
Status_Code 200
X-Mashery-Message-ID 9ebad058-e4e5-4cc9-b9cf-bf33dee9fbc6
X-Mashery-Responder prod-j-worker-us-west-1b-58.mashery.com
X-Plan-QPS-Allotted 6
X-Plan-QPS-Current 1
X-Plan-Quota-Allotted 7000
X-Plan-Quota-Current 5
X-Plan-Quota-Reset Friday, January 29, 2016 12:00:00 AM GMT
Statuscode 200 OK
Text YES