Hi Herman,
I also tried
I am using HealthShare 2015.2.1
Any ideas?
Hi Herman,
I tried to modify my code as per your suggestions. The URLinside route is set to /UserAccounts. But, it didn't work. I have added trace elements to check what I receive.
The _tEmailID element for which I used the %request.Get, it does not receive the parameter passed to it.
The Event log for service shows that _tEmailID is empty.
Can you have a look at my method and suggest anything if I have missed? Is it required to add any library to use %request?
{
set status = $$$OK
try{
SET tEmailID = %request.Get("account")
$$$TRACE("tEmaildID = "_tEmailID)
ZNSpace "INSTATEMPNS"
&sql(SELECT EmailID,Password INTO :email,:pwd FROM InstaTemp.ISAccounts WHERE EmailID = :tEmailID )
$$$TRACE("email = "_email)
set tProxy = ##class(%ZEN.proxyObject).%New()
IF SQLCODE'=0
{
set tProxy.Email = tEmailID
set tProxy.Pwd = "no password"
set tProxy.SqlCode = SQLCODE
}
ELSE
{
set tProxy.Email = email
set tProxy.Pwd = pwd
set tProxy.SqlCode = SQLCODE
}
//set tProxy = ##class(%ZEN.proxyObject).%New()
//set tProxy.Email = email
//set tProxy.Pwd = pwd
// You could just write the output manually or use helper methods like ..ObjectToJSONStream() to generate JSON
do pOutput.SetAttribute("Content-Type","application/json")
do pOutput.Write("[")
Set tOut=##class(%IO.StringStream).%New()
do ..ObjectToJSONStream(tProxy,.tOut)
do tOut.Rewind()
do pOutput.Write( tOut.Read() )
do pOutput.Write("]"_$C(13,10))
} catch (e) {
set status = e.AsStatus()
}
quit status
}
Yes, I tried that too. It also does not takes the value of query. Checking with $$TRACE, tEmaildID still turns out to be empty.