[Stackoverflow] [Progress OpenEdge ABL] Progress Openedge syntax to read array data from url back into temp-table

Status
Not open for further replies.
G

guy

Guest
i suspect the answer to this will be laughably simple, but i am new to this, and cant find anything on the forms. In a small webhandler class, i have written a handleget procedure that, when called using the relevant http address, via web or postman returns an array of data from our database.

METHOD OVERRIDE PROTECTED INTEGER HandleGet (poRequest AS OpenEdge.Web.IWebRequest):

DEFINE VARIABLE oResponse AS WebResponse NO-UNDO .
DEFINE VARIABLE oJson AS JsonObject NO-UNDO .
DEFINE VARIABLE oArray AS JsonArray NO-UNDO .

DEFINE VARIABLE oUsers AS JsonObject NO-UNDO .
DEFINE VARIABLE oError AS JsonObject NO-UNDO .



ASSIGN
oResponse = NEW WebResponse ()
/* HTTP messages require a content type */
oResponse:ContentType = 'application/json':U

cQryString = poRequest:GetPathParameter("WhoIsThere").


/* cQryString = STRING(poRequest:GetContextValue("QUERY_STRING")). */

oJson = NEW JsonObject () .

GetUserandPass ().


oJson:Add("name", cName) .
oJson:Add("password", cPassword) .

custLkUp ().

oUsers = NEW JsonObject () .

oUsers:Read (TEMP-TABLE ttUser:HANDLE, TRUE /*omitInitlVals*/, FALSE /*readBeforeImage*/) .
oJson:Add ("users", oUsers:GetJsonArray("ttUser")) .


oResponse:Entity = oJson .


using the post facility on postman, i have altered some of the data, with the wish that, on send, the array, complete with altered data is posted back to my code where the changes can be applied to the database. the file/array structure will not change in anyway, but there will be delays between sending the data to the url and the post back. i am trying to do this in a handlepost procedure. How do i capture the changed array,

have tried

oJson = CAST(poRequest:entity,JsonObject)
buffer ttUserupd:READ-JSON("json object", oJson, "empty").


to read it into identical temptable structure but keeps saying invalid handle in the agentlog. what have i missed?

Continue reading...
 
Status
Not open for further replies.
Top