File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -142,6 +142,41 @@ http://localhost:8888/rest/metrics/system/timezone/name?locale=zh_TW
142142http://localhost:8888/rest/metrics/system/timezone/utcHourOffset
143143```
144144
145+ ### REST request matching
146+
147+ When a REST request is processed, the matching rest method is found by looping thru all the functions, in the order defined within the CFC.
148+
149+ As in this example, specific ` restPaths ` should be placed before more generic, catch all ` restPaths ` .
150+
151+ Since 7.0.0.368
152+
153+ ``` cfml
154+ component restPath="/api/products" rest="true" {
155+ // GET /api/products/search?category=electronics
156+ remote function searchProducts( string category="" restArgSource="url" )
157+ httpMethod="GET" restPath="/search" {
158+ return {
159+ "message": "Product search completed",
160+ "filters": {
161+ "category": arguments.category
162+ },
163+ "method": "searchProducts"
164+ };
165+ }
166+
167+ // GET /api/products/123
168+ remote function getProduct( string productID restArgSource="path" )
169+ httpMethod="GET" restPath="/{productID}" {
170+ return {
171+ "message": "Single product retrieved",
172+ "productID": arguments.productID,
173+ "method": "getProduct"
174+ };
175+ }
176+ }
177+ ```
178+
179+ Falling back to using function names as the REST Path, when no ` restPath ` is defined, was implemented in 7.0.0.366
145180
146181### Configuring your web server to serve Lucee's REST services
147182
You can’t perform that action at this time.
0 commit comments