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