User Guide Cancel

RestSetResponse

 

Description

Sets the custom responses.

History

ColdFusion 10: Added this function

Syntax

restSetResponse(response)
restSetResponse(response)
restSetResponse(response)

Parameters

Parameter

Description

response

A struct that contains the response details.

Warning

Note: ColdFusion ignores the function's return value and uses the response set using the RestSetResponse() function.

Example

<cffunction name="create" httpMethod="POST" produces="application/xml">
<cfargument name="id" type="numeric">
<cfargument name="name" type="String">
<cfset var response={
status=201,
content="<customer id="&id&"><name>"&name&"</name></customer>">,
headers={
location="http://localhost:8500/rest/CustomerService/customers/123",
}
}>
<cfset restSetResponse(response)>
<cffunction>
<cffunction name="create" httpMethod="POST" produces="application/xml"> <cfargument name="id" type="numeric"> <cfargument name="name" type="String"> <cfset var response={ status=201, content="<customer id="&id&"><name>"&name&"</name></customer>">, headers={ location="http://localhost:8500/rest/CustomerService/customers/123", } }> <cfset restSetResponse(response)> <cffunction>
<cffunction name="create" httpMethod="POST" produces="application/xml"> 
<cfargument name="id" type="numeric"> 
<cfargument name="name" type="String"> 
<cfset var response={ 
status=201,
content="<customer id="&id&"><name>"&name&"</name></customer>">,
headers={
location="http://localhost:8500/rest/CustomerService/customers/123",
}
}>
<cfset restSetResponse(response)>
<cffunction>

Get help faster and easier

New user?