SurveyMonkey api Coldfusion issue -


i'm having trouble getting header param "authorization" work correctly using cfhttp , cfhttpparam.

the connection working fine... getting out through our proxy that's not issue.

the api documentation states "authorization" in header should formatted "authorization:bearer xxxyyyzz".

when try add "bearer" space after following error: {"status":3,"errmsg":"expected object or value"}

when not add prefix "bearer" @ following error: {"status":1,"errmsg":"invalid \"authorization\" data in request header"}

i've tried "bearer xxxyyyzz" , "bearer%20xxxyyyzz" , "bearer xxxyyyzz" 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 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 gmt

statuscode 200 ok
text yes

looks need send empty json struct in body. api requires json input, if there no parameters sent in. add cfhttpparam of type body value of {}

<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">     <cfhttpparam name="body" type="body" value="{}"> </cfhttp> <cfdump var="#httpresponse#"> 

Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -