Hi, I'm having some trouble getting our REST servi...
# lucee
w
Hi, I'm having some trouble getting our REST services to run in Lucee. I have two files with the following REST paths:
Copy code
Orders.cfc - restpath: /{lookupKey}/{key}
ClassAddresses.cfc - restpath: /{class}/{lookupKey}/{classId}/addresses
When I call the endpoint in Orders.cfc like this:
GET <basepath>/orders/id/35
, it works fine. However, when I call
GET <basepath>/orders/id/35/addresses
, which is located in ClassAddresses.cfc, I encounter an error:
"no rest service for [/orders/id/35/addresses] found."
I'm sure that the restpath in ClassAddresses.cfc is correct because when I rename the CFCs to, for example, 1_Orders.cfc and 2_ClassAddresses.cfc, I get results for both endpoints. It seems that the alphabetical order of the files matters. Is this the expected behavior when specifying similar/overlapping restpaths in different files?
g
It has been a really long time since I used native CFC calls for REST, We use TAFFY. It has been around for a really long time and is still maintained. It is also spectacularly uncomplicated to install / configure and use. And there is a "Taffy" channel in CFML slack, too. (not that any of that really helped!!!)
w
The decision to go with native CFC calls for REST was made a couple of years ago, unfortunately not something we can easily change for Taffy. I do appreciate your comment though 👍
Maybe somebody else from the Lucee community can help, I can't find any related Jira issue or maybe this works as designed, @zackster?
z
my reading of the code more or less is as it stands, is that it resolves a component which matches the base rest path and then looks within the metadata of that found component for the matching function, as such there is no support for overlapping components