Whatever message this page gives is out now! Go check it out!
<hostname>:<port>/restplay. In REST Playground, you can add and manage your REST services, without involving the ColdFusion Administrator.Application path (Required) | The path to the folder that contains the REST-enabled CFCs. |
Host (Optional) | Host name for the REST service. For example, localhost:8500. |
Service Mapping (Optional) | Identifier for the REST application when calling the service. |
Set as default application (Optional) | By setting the application as default, you can exclude the name of the application in the URL, when invoking the service. For a host, you can make only one application as default. |
{ "price": 13900, "id": 2, "name": "Michael"}component hint="This is a student cfc"
{
property name="name" type="string" displayname="name" hint="name of student";
property name="age" type="numeric" displayname="age" hint="age of student";
}component restpath="student"{
remote any function addStudentPost(student st) httpmethod="POST" restpath="addStudent"
{
studentcomp.name = st.name;
studentcomp.age = st.age;
return studentcomp;
}
}access="remote" in REST functions. It is assumed inherently for all the REST enabled functions.<cffunction name="onRESTRequest" returntype="any" output="true">
<cfargument type="string" name="cfcname" required=true>
<cfargument type="string" name="method" required=true>
<cfargument type="struct" name="args" required=true>
<cflog text="onRESTRequest() Before">
<cfinvoke component = "#cfcname#" method = "#method#" argumentCollection = "#args#" returnVariable = "resultval">
<cflog text="onRESTRequest() After">
<cfreturn "#resultval#">
</cffunction>component restpath="users" rest="true"
{
import student;
student = createobject("component","student");
student.name = "Joe";
student.age = 22;
remote any function patchuser(struct x) httpmethod="PATCH" restpath="patchuser"
{
//x is patched object
return x;
}
remote any function patchuserget() httpmethod="GET" restpath="patchuser"
{
return student;
}
}[
{
"op" : "replace",
"path" : "/age",
"value" : "40"
}
]this.restSettings.restEnabled=true) variables.