How could we retrieve REST body?

Primary tabs

Replies

Hello Eduard

We would need to be able to send a REST POST meesage with the following body:

{
"provider":"provider",
"group""group",
"location""location",
"data""data",
"checkin""checkin",
"client""client",
"admin""admin",
"apiUrl""apiUrl"
}
 
 

And get the previous body inside our Service.

We have written as a Service:

Class Servicios.REST.HistoriaClinica.Videoconsulta Extends Ens.BusinessService
{ Parameter ADAPTER = "EnsLib.HTTP.InboundAdapter"; Method OnProcessInput(pInput As %RegisteredObject, Output pOutput As %RegisteredObject) As %Status
{
do ..enviarCitaCrearSala(pInput,.pOutput)
quit $$$OK
} Method enviarCitaCrearSala(pInput As %Stream.Object, Output pOutput As %Stream.Object) As %Status
{
//TODO: Get body


set tSC = ..SendRequestSync("Videoconsulta",body,.objetoSalida)
set claseAux = ##class(%ZEN.Auxiliary.jsonProvider).%New()
set tSC = claseAux.%WriteJSONStreamFromObject(.pOutput,.objetoSalida,,,,"aeloqtuw")

Quit tSC
}