I've been playing with ColdFusion 11's REST API support and am wondering if it's possible to have it support a URI with a dynamic token in the middle of the URI instead of only at the end. That is, it very easily supports URIs like:
/rest/users/12345
where the 12345 is dynamic (in this case, the user's userID). But I haven't been able to find a way (without a tremendous amount of URI hacking) to support URIs like:
/rest/users/12345/emailAddresses
So, is it possible to do this in ColdFusion (11 or 2016)? If not, is it supported in Taffy (I didn't see where it is but I could be wrong)?
TIA
It's been a while and I wanted to provide the answer in case anyone else has this same question...
ColdFusion, when defining a CFC for a REST endpoint, allows you to specify wildcards/variable names in the
restpathattribute to both the<cfcomponent>and<cffunction>tags. You would then define<cfargument>tags for each one of these variables so that you can access them within your function. For example:The keys here are using the
restpathattribute with the variable defined as a variable name in curly braces and then defining those variables as arguments to the function with arestargsourceattribute set to "Path".I hope this helps.