Good Morning Danny,

I appreciate your help. After  changing the names i was able to  make the POST calls using SEND. Worked perfectly ! Thank you for your time.

Yes,  looks like .Send has some more configurable parameters in the HttpRequest object we send.

In the same context, would you be able to know how to set a Basic Authoriztion using User and Pass while making the call ?

Seems like i have to make Credentials using ENSEMBLE.

Than set the httprequest.username and httprequest.password using that credential object.

Please let me know if you have any information.

Thank you for time.


Jimmy Christian.

Thank you Danny for help.

Yes this worked. I did not create a seperate HttpRequest but just used the PostURL method as below.

Set tSC=..Adapter.PostURL(tURL,.tHttpResponse,,pRequest1.%ToJSON()).

The code you provided is very helpful. Especially when i have to include the content type while making the http request.

The Adapter object does not have that ContentType property.

By the way i am also trying to understand when to use the PostURL or .Send or SendFormDataArray method to make a http request?

Do they provide same functionality ? If you have information and can provide me will be much appreciated.

Thank you

Jimmy Christian.

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


How do i send it to 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.


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 Marc. Looks like this  Issue is resolved . Appreciate your input.

Yes, I did. 

       set tRequest=##class(Ens.StreamContainer).%New(pInput)
      do tRequest.%Save()
      set tSC = ..SendRequestAsync(..TargetConfigNames,tRequest)


Jimmy Christian.

Hello Eduard,

I used %Stream.FileCharacter to resolve the error on Operation which is complaining that "No Stream contained in StreamContainer Request".

I am going to use the JSON serialization once i  refer to some document about it. 

Thank you for help.

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)
while 'pInput.AtEnd {
          do pInput.ReadLine()
          set tRequest=##class(Ens.StreamContainer).%New(pInput)
          set tSC = ..SendRequestAsync(..TargetConfigNames,tRequest)

Thank you Stephen. I will check the link you provided for more understanding on REST.

Hello Evgeny,

Yes this worked perfectly. I think i did select %ALL role, but did not click on assign but only SAVED it.

Thank you for all your help. But looks like at some point once i familiarize myself with this web and rest app build, i will need to learn more about security..


Jimmy Christian.