Salesforce

How to get the list of applications from a PASOE Agent using OE Manager's REST API?

« Go Back

Information

 
TitleHow to get the list of applications from a PASOE Agent using OE Manager's REST API?
URL NameHow-to-get-the-list-of-applications-from-a-PASOE-Agent-using-OE-Manager-s-REST-API
Article Number000113378
EnvironmentProduct: OpenEdge
Version: 11.7.4
OS: All Supported Platforms
Question/Problem Description
This article provides an example of using the ABL HttpClient libraries to fetch the applications installed in a PASOE agent along with their status.
 
Steps to Reproduce
Clarifying Information
Error Message
Defect Number
Enhancement Number
Cause
Resolution
/*------------------------------------------------------------------------
    File        : get_applications.p
    Purpose     : Returns the list of applications from a PASOE server
    Notes       : * this is the equivalent of curl -X GET -v http://localhost:<port>/oemanager/applications/ -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('oerealm', 'tomcat', 'tomcat').

oUri = new URI('http', 'localhost', <http-port>).
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.

 
Workaround
Notes
References to Other Documentation:

Progress Article(s):
 Is there an HTTP client for OpenEdge?
 OpenEdge.Net.pl is missing from PROPATH

 
Keyword Phrase
Last Modified Date11/20/2020 7:01 AM

Powered by