Question
· May 4, 2017

REST API method name Case insensitive

Hi all,

I've a RESP API service in a Business Service to server different methods

I've created the route with the name of the method, each one has been created in lowercase 

XData UrlMap [ XMLNamespace = "http://www.intersystems.com/urlmap" ]
{
<Routes>
    <Route Url="/user" Method="POST" Call="User"/>
    <Route Url="/emailactivation" Method="POST" Call="EmailActivation" />
    <Route Url="/login" Method="POST" Call="Login"/>
</Routes>
}

But only there is a response if the call is used in lowercase

http://localhost:57772/mynamespace/emailactivation

my question is, is it possible to create a case insensitive  method name?

Best regards

Discussion (2)0
Log in or sign up to continue

When you define UrlMap, you should remember, that Caché uses Regular expressions. So, you can just put (?i) before Url, to make regular expression case insensitive

XData UrlMap [ XMLNamespace = "http://www.intersystems.com/urlmap" ]
{
<Routes>
    <Route Url="(?i)/user" Method="POST" Call="User"/>
    <Route Url="(?i)/emailactivation" Method="POST" Call="EmailActivation" />
    <Route Url="(?i)/login" Method="POST" Call="Login"/>
</Routes>
}