????
?????ݡ??ͥ???????
?㡧main.cfc
rest??ture??restpath?ϡ?cfc???إѥ??????ܤ????Ǹ???cfc?ե?????̾?γ?ĥ??ȴ???ǵ??ܡ??Ĥޤꡢrest/api/main.cfc?ξ????ϡ?/rest/api/main?Ȥʤ롣
<cfcomponent rest="true" restpath="/rest/api/main" name="main">
<!--- ?????ݡ??ͥ??Ⱥ????????̾?Application.cfc?˵??? --->
<cffunction name="setValue" access="remote" returntype="String" httpmethod="GET">
<cfargument name="ArguValue" type="string" required="yes">
<cfif ArguValue neq "">
<cfset status = "200">
<cfset message = "success">
<cfset TestValue = #ArguValue#>
<cfelse>
<cfset status = "500">
<cfset message = "error">
<cfset TestValue = "">
</cfif>
<!--- ???????̤?JSON???֤? --->
<cfset data = StructNew()>
<cfset data.status = status>
<cfset data.message = message>
<cfset data.value = TestValue>
<cfreturn SerializeJSON(data)>
</cffunction>
</cfcomponent>
?????ݡ??ͥ?????????
?㡧application.cfc
<cfset login = CreateObject("component","rest.api.main")>
CreateObject("component","cfc?ݴɥե?????.cfc?γ?ĥ??̵???ե?????̾")>
API?ƽФ??? ???ºݤ?API?Ȥ??Ƴ????˸????????ե?????
?㡧index.cfm
#main.setValue(ArguValue)#https://hoge.com/rest/api/
??å?:GET
?͡?ArguValue: xxxxxx(string)