Yes, I tried that too. It also does not takes the value of query. Checking with $$TRACE, tEmaildID still turns out to be empty.
- Log in to post comments
Yes, I tried that too. It also does not takes the value of query. Checking with $$TRACE, tEmaildID still turns out to be empty.
Hi Herman,
I also tried SET tEmailID = $Get(%request.Data("account",1)). But even then, tEmailID comes up empty in the trace.
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?
Method retrieveAccount(pInput As %Library.AbstractStream, Output pOutput As %Stream.Object) As %Status
{
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
}
Hi Scott,
I am a newbie here, so my queries are a little basic.
I tried to change the format of URL like this http://localhost:57772/myDemo/myService/UserAccounts?email=abc@gmail.com
But, then I get an error in my service which is s follows:
ERROR <Ens>ErrGeneral: Unsupported REST URL: /UserAccounts%3Femail%3Dabc%40gmail.com for HTTP command GET
Can you tell me why this didn't work?
Thanks
The above queries are from me. Let me know if any additional information is required.
Thanks Joshua for the support.