Pierre LaFay · Aug 21, 2023 go to post

Hi Ashok,

Thank you for your answer, I understand and will apply looping by Next in Data.

However, I don't know how to merge the entire %request.Data into local array and use string function.

I'm sorry for asking questions that should be obvious, but I'm new to Iris for REST Api...

Pierre LaFay · Aug 20, 2023 go to post

I found a way by %request.Data("Top",1), but in this case, I get parameters one by one.

Is a method to get all my parameters in an object or an array exists ?

Pierre LaFay · Aug 20, 2023 go to post

Hi Eduard,

Many thanks for yours answers

My app config is same of you, except I use JWT token authentification (UnKnownUser doesn't have %ALL) :

Pierre LaFay · Aug 13, 2023 go to post

Hi ashok,

There is the same issue, Page method in my %CSP.REST subclass is not called...

Pierre LaFay · Aug 11, 2023 go to post

Hi Ashok,

Thanks for your reply, overriding OnPreDispatch Method doesn't not work with login, refresh, logout (special routes) but with my own routes it's work. So It's not a solution for me

This the beginning of my class which extends %CSP.REST,  I missed something ?

Class Bna.Api.Bna2024 Extends %CSP.REST
{
Parameter HandleCorsRequest = 1;
Parameter CHARSET = "UTF-8";
Parameter CONTENTTYPE = "application/json";
XData UrlMap [ XMLNamespace = "http://www.intersystems.com/urlmap" ]
{
<Routes>
    <Route Url="/lists" Method="GET" Call="GetLists" />
    <Route Url="/me" Method="GET" Call="GetUserInformations" />
    <Route Url="/reset-password" Method="POST" Call="ResetUtilisateurPassword" />
    <Route Url="/utilisateurs" Method="GET" Call="GetUtilisateur" />
    <Route Url="/utilisateurs" Method="POST" Call="CreateUtilisateur" />
    <Route Url="/utilisateurs" Method="PATCH" Call="ModifyUtilisateur" />
    <Route Url="/utilisateurs" Method="DELETE" Call="DeleteUtilisateur" />
</Routes>
}
ClassMethod OnPreDispatch(pUrl As %String, pMethod As %String, ByRef pContinue As %Boolean) As %Status
{
    Set ^Pierre("login")="on login (by overrided method pre dispatch)"
    return $$$OK
}
...
Pierre LaFay · Aug 11, 2023 go to post

Thanks Eduard,

That's my first try  (doesn't work, global ^Pierre not set with login)

It seems that method in my class doesn't override the methods on %CSP/REST.

This the beginning of my class which extends %CSP.REST, Do I miss something ?

Class Bna.Api.Bna2024 Extends %CSP.REST
{
Parameter HandleCorsRequest = 1;
Parameter CHARSET = "UTF-8";
Parameter CONTENTTYPE = "application/json";
XData UrlMap [ XMLNamespace = "http://www.intersystems.com/urlmap" ]
{
<Routes>
    <Route Url="/lists" Method="GET" Call="GetLists" />
    <Route Url="/me" Method="GET" Call="GetUserInformations" />
    <Route Url="/reset-password" Method="POST" Call="ResetUtilisateurPassword" />
    <Route Url="/utilisateurs" Method="GET" Call="GetUtilisateur" />
    <Route Url="/utilisateurs" Method="POST" Call="CreateUtilisateur" />
    <Route Url="/utilisateurs" Method="PATCH" Call="ModifyUtilisateur" />
    <Route Url="/utilisateurs" Method="DELETE" Call="DeleteUtilisateur" />
</Routes>
}

ClassMethod Login(skipheader As %Boolean = 1) As %Status [ ProcedureBlock = 0 ]
{
    Set ^Pierre("login")="on login (by overrided Login method)"
    Return ##super(skipheader)
}
...
Pierre LaFay · Aug 6, 2023 go to post

Thanks Julius

I also found the %OnNew() method for consytructor of the object