I am calling the API and I need to send it a JSON string with credentials. We are currently moving from CF9 to CF2016. In DEVL, I have both versions. In Test and Prod, I currently only have CF9. I originally wrote the code and tested it on CF2016, and it worked great. When I pushed him to test, it didn't work. I repeated in DEVL, on CF9, and these are also errors. Code:
<cfset logininfo = {"username": "eistech", "password": "#sat_pw#"}> <cfset fromdate=dateformat(DateAdd('d', -1, dat), "yyyy-MM-dd") & 'T00:00:00-0500'> <cfhttp url="https://scoresdownload.collegeboard.org/pascoredwnld/files/list?fromDate=#fromdate#" method="post" result="finfo"> <cfhttpparam name="Content-Type" type="HEADER" value="application/json"> <cfhttpparam name="Accept" type="HEADER" value="application/json"> <cfhttpparam type="body" value="#serializeJSON(logininfo)#"> </cfhttp>
When launched in CF9, I get:
The incorrect CFML construct found in row 5 in column 20. ColdFusion was looking at the following text: { (Line 20 is <cfset logininfo = {"username": "eistech", "password": "#sat_pw#"}>
I tried to include it in single quotes, but this failed in both cases. How can I get this to work in both CF2016 and CF9?
source share