Question
· Mar 27

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": ["&lt;PARAMETER&gt;test+1^test.Dispatcher.1"]

}],

"summary":"ERROR #5002: ObjectScript error: &lt; PARAMETER&gt;test+1^test.Dispatcher.1"

}

ClassMethod test() As %Status{

   Set %response.ContentType = #CONTENTTYPEJSON

   return $$$OK

}

Product version: IRIS 2023.1
Discussion (2)2
Log in or sign up to continue

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
}

}