Hello Eduard,

i was able to convert the HttpResponse.Data to String and than to the Dynamic Object. Worked great. Thank you.

On the same line, i need to ask you of any template or suggestion to send a JSON data to a REST API.

For eg. below is the JSON

{"name":"abcdefghi","salary":"123","age":"23"}

How do i send it to  http://testing.restapiexample.com/api/v1/createemployee with POST request using the  set tSC=..Adapter.PostURL(tConfig.URL,.tHTTPResponse,,pRequest)

Below code is not working.

Set pRequest=."{"name":"abcdefghi","salary":"123","age":"23" }"

Your help will be appreciated.

Thanks,

Jimmy Christian.

Yes, Thank you. I just corrected the URL and it works now. Thank you Robert.  One more question if you can assist in this context.

So the response message i got back is in the HttpResponse object.

How can i convert the HttpResponse.Data property to JSON and parse the values. Since the data i received is Stream, is there a way i can convert the stream to Dynamic Objects and parse  it?

Thank you.

Jimmy Christian.

Thank you Aldo for checking this out. I tried to make it much simpler by using what you suggested. I was hoping the operation to  accept it since pInput is a Stream.

But still the same error. Operation does not find STREAM in the ENS. StreamContainer.

Class Hospital.ApptListFileService Extends Ens.BusinessService
{
Parameter ADAPTER = "EnsLib.File.InboundAdapter";
Parameter SETTINGS = "TargetConfigNames";
Property TargetConfigNames As Ens.DataType.ConfigName;
Property SentMsg As %FileCharacterStream;

Method OnProcessInput(pInput As %FileCharacterStream, Output pOutput As %RegisteredObject) As %Status
{
set tSC = $$$OK
    set pInput.LineTerminator=$c(10)
try 
{
while 'pInput.AtEnd {
          do pInput.ReadLine()
         
          set tRequest=##class(Ens.StreamContainer).%New(pInput)
  
          set tSC = ..SendRequestAsync(..TargetConfigNames,tRequest)
}

Yep. Select INTO works great if the source and target tables are in same NAMESPACE. I need to copy the data across namespaces, for which i  have already some another method. 

But i found that copying recordset would also work, since once the object is created i can easily write to another table on a different "NAMESPACE". Only issue is to write to a target table from a recordset i need to loop it and am not aware of a straightforward copy.

I cannot share globals on the namepsace i am working on.

Actually i was able to retrieve data from Namespace2  working on a callback method for recordset which the table  is using. But now issue is zenpage only shows the first page.

Will try to find out a reason why the page is hanging. It could be that i have to flip back to Namespace1 once i get the recordset.

Thanks.