[progress Communities] [progress Openedge Abl] Forum Post: Re: Using .net To Get Data From...

  • Thread starter Thread starter Peter Judge
  • Start date Start date
Status
Not open for further replies.
P

Peter Judge

Guest
Jeff, You can also use ABL for this. There are some samples on GitHub, specifically https://github.com/PeterJudge-PSC/http_samples/blob/master/http_client/pasoe_rest_api/get_applications.p /*------------------------------------------------------------------------ File : get_applications.p Purpose : Returns the list of applications from a PASOE server Author(s) : pjudge Created : Thu Oct 13 09:17:32 EDT 2016 Notes : * this is the equivalent of curl -X GET -v localhost:16680/.../ -u tomcat:tomcat ----------------------------------------------------------------------*/ block-level on error undo, throw. using OpenEdge.Net.HTTP.ClientBuilder. using OpenEdge.Net.HTTP.Credentials. using OpenEdge.Net.HTTP.IHttpClient. using OpenEdge.Net.HTTP.IHttpRequest. using OpenEdge.Net.HTTP.RequestBuilder. using OpenEdge.Net.URI. using OpenEdge.Net.HTTP.IHttpResponse. using Progress.Json.ObjectModel.JsonObject. /* *************************** Session config *************************** */ /* OPTIONAL FOR DEBUG/TRACING session:error-stack-trace = true. log-manager:logging-level = 6. log-manager:logfile-name = session:temp-dir + 'get_applications.log'. log-manager:clear-log(). */ /* *************************** Main Block *************************** */ define variable oClient as IHttpClient no-undo. define variable oUri as URI no-undo. define variable oReq as IHttpRequest no-undo. define variable oResp as IHttpResponse no-undo. define variable oCreds as Credentials no-undo. define variable oJson as JsonObject no-undo. oClient = ClientBuilder:Build():Client. oCreds = new Credentials('', 'tomcat', 'tomcat'). oUri = new URI('http', 'localhost', 16680). oUri:Path = '/oemanager/applications/'. oReq = RequestBuilder:Get(oUri) :UsingCredentials(oCreds) :Request. oResp = oClient:Execute(oReq). if type-of(oResp:Entity, JsonObject) then assign oJson = cast(oResp:Entity, JsonObject). /* do what you need to with the JSON here */ catch oError as Progress.Lang.Error : message oError:GetMessage(1) skip(2) oError:CallStack view-as alert-box. end catch.

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