Generic route
I'm working with routes for a rest service with intersystems iris. I have a working /test path, but I want to create a regex that accepts any path passed after /test. example /test/sdjklsbdk or /test/sdfkjgbskdbf/skjbksdb/ksdjbdks
I used <Route Url="/test/(.*)" Method="POST" Call="test"/> and <Route Url="/test/:path" Method="POST" Call="test"/> and I got the error <PARAMETER> what could it be?
{
"errors":[{
"code": -5002,
"domain": "%ObjectErrors",
"error":"ERROR #5002: ObjectScript error: <PARAMETER>test+1^test.Dispatcher.1",
"id": "ObjectScriptError",
"params": ["<PARAMETER>test+1^test.Dispatcher.1"]
}],
"summary":"ERROR #5002: ObjectScript error: < PARAMETER>test+1^test.Dispatcher.1"
}
ClassMethod test() As %Status{
Set %response.ContentType = #CONTENTTYPEJSON
return $$$OK
}
Comments
The regex Route is the correct way to do this:
Class User.REST Extends%CSP.REST
{
XData UrlMap [ XMLNamespace = "http://www.intersystems.com/urlmap" ]
{
<Routes>
<Route Url="/(.*)" Method="GET" Call="test" />
</Routes>
}
ClassMethod test(path As%String) As%Status
{
Set%response.ContentType = ..#CONTENTTYPETEXT
Write path
Return$$$OK
}
}Thanks