go to post Pierre LaFay · Dec 23, 2023 Thanks for this article, Just what I need to start using python (I use Objectscript since 12 years), and examples is more efficient for me.
go to post Pierre LaFay · Dec 21, 2023 I asked intersystems for the same question, the solution is to upgrade to 2023.3 (2023.1 has issue in error reporting in Atelier)
go to post Pierre LaFay · Dec 21, 2023 To complete @Ashok Kumar answer, the good way to get file content : Set source = %request.GetMimeData("file") Set destination=##class(%Stream.FileBinary).%New() Set destination.Filename="/opt/irisbuild/output/"_source.FileName set tSC=destination.CopyFrom(source) //reader open the file set result=destination.%Save()
go to post Pierre LaFay · Dec 18, 2023 Hi Zhang, In the portal : System/Security/Roles you can create your own role like "myUserRole". When created you have in the role definition a tab "Sql Tables". In this tab you can add the tables which the role can access. If you assign the created role to a user, he can access the tables. hardcopy of the Sql Tables Tab in System/Security/Roles (in french)
go to post Pierre LaFay · Dec 13, 2023 You can access your elements by this way (for the example, your object is named jsObj) w jsObj.%Get(0).thingone,! Red w jsObj.%Get(0).thingtwo,! Green w jsObj.%Get(1).thingone,! Blue w jsObj.%Get(1).thingtwo,! Yellow Caution : For dynamic array, first element is indexed by 0, not 1 like ObjectScript standard arrays
go to post Pierre LaFay · Nov 14, 2023 Thanks Julius, It was exactly what i needed. My goal was to copy properties from a dynamic object to a persistent object, but in dynamic object for reference, I have only id, not a ref. So i made this : (main class) Class Bna.Utils.DynToPersistent Extends %RegisteredObject { Property DynObject As %Library.DynamicObject; Property PersistentObject; Method %OnNew(dynObject As %Library.DynamicObject, persistentObject) As %Status { Set ..DynObject = dynObject Set ..PersistentObject = persistentObject Return $$$OK } Method copyDynToPersistent() { set pClass = ..PersistentObject.%ClassName(1) Set iterator = ..DynObject.%GetIterator() while iterator.%GetNext(.pProp, .pValue) { Set pType = ##class(Bna.Utils.Common).GetPersistentObjectPropertyType(pClass,pProp) Set isRef = ##class(Bna.Utils.Common).PersistentObjectPropertyTypeIsReference(pType) if isRef { set value = $ZOBJCLASSMETHOD(pType, "%OpenId", pValue) } else { set value = pValue } Set $ZOBJPROPERTY(..PersistentObject, pProp) = value } } } (utility methods) : ClassMethod GetPersistentObjectPropertyType(pClass As %String, pKey As %String) As %String { set def=##class(%Dictionary.PropertyDefinition).%OpenId(pClass_"||"_pKey) if def Return def.Type } ClassMethod PersistentObjectPropertyTypeIsReference(pType) As %Boolean { if $EXTRACT(pType,1,1) = "%" { Return 0 } else { Return 1 } } I think my test for reference detection can be light, but enough in my context
go to post Pierre LaFay · Nov 13, 2023 Thanks George, It's not what i search, I would have the type, not test if is one type.
go to post Pierre LaFay · Aug 21, 2023 Hi Eduard, Thanks for this utility method. I think I will use it for debugging
go to post Pierre LaFay · Aug 21, 2023 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...
go to post Pierre LaFay · Aug 20, 2023 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 ?
go to post Pierre LaFay · Aug 20, 2023 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) :
go to post Pierre LaFay · Aug 13, 2023 Hi Eduard, I'm sorry but I don't understand what you exactly mean
go to post Pierre LaFay · Aug 13, 2023 Hi ashok, There is the same issue, Page method in my %CSP.REST subclass is not called...
go to post Pierre LaFay · Aug 11, 2023 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 } ...
go to post Pierre LaFay · Aug 11, 2023 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) } ...
go to post Pierre LaFay · Aug 6, 2023 Thanks Julius I also found the %OnNew() method for consytructor of the object