Question Alexander Grishkan · Mar 8, 2017

HTTP request payload

I am sending an HTTP request to cache class:

s rObj=##class(%Net.HttpRequest).%New()s rObj.Server="www.xyz.com"s rObj.Https=1s rObj.SSLConfiguration="xyz"s rObj.ContentType="application/json"d rObj.EntityBody.Write("payload in json format")s sc=rObj.Post("/csp/ns/xyz.cls")

The request gets to the OnPreHTTP class method 

Class xyz Extends %CSP.Page [ ProcedureBlock ]
{

ClassMethod OnPreHTTP() As %Boolean
{
    q 1

}

}

The question is how to retrieve the request payload in the OnPreHTTP method.

Comments

Eduard Lebedyuk · Mar 8, 2017

%request.Content is a stream with all JSON payload.

If you want to process HTTP requests, you can use REST API.

0
Alexander Grishkan · Mar 8, 2017

Thank you Eduard,

The %request.Content it is. I don't have REST API in my Cache - 2010.2.7.

0
Fabian Haupt  Mar 8, 2017 to Alexander Grishkan

You should consider upgrading, 2010.2.7 is long since past its age limit.

0
Alexander Grishkan · Mar 9, 2017

I know Fabian. We're in the process of upgrading but for the short while I needed  the solution.

Thanks.

0