Return JSON data in response in ColdFusion

I work in the ICIMS API. I need to return the JSON data and some specific data in the header in the cfm page call by the ICIMS server.

Here is the answer:

Response to workflow status PUSH event change to platform:

HTTP/1.1 303 See Other
Location: http://xx.xx.xx.xx:8085/selectpackage?systemHash=101
Content-Type: application/json
{
"userMessage":"Confirm or modify package.",
}

Thanks in advance.

Answer:

> <cfset contentString = '{"userMessage": "Confirm or modify package."}'
> />
> 
> <cfheader name="Location"
> value="http://xx.xx.xx.xx:8085/selectpackage?systemHash=101" />
>     <cfcontent type="application/json" variable="#toBinary( toBase64( contentString ) )#" />
+4
source share
1 answer
<cfheader 
    statusCode = "303"
    statusText = "See Other">

<cfheader 
    name="Location" 
    value="http://xx.xx.xx.xx:8085/selectpackage?systemHash=101">

<cfheader 
    name="Content-Type" 
    value="application/json">

<cfset foo = structNew()>
<cfset foo["userMessage"] = "Confirm or modify package.">

<cfoutput>#serializeJSON(foo)#</cfoutput>  
+8
source

All Articles