To execute an HTTP request, you need a client object and a response object. Use the OpenEdge.Net.HTTP.ClientBuilder class to create a client object that implements the OpenEdge.Net.HTTP.IHttpClient interface. Then, call the Execute() method on the client object. The response returned by the server application or service is copied to the response object. For example:

USING OpenEdge.Net.HTTP.*.
USING OpenEdge.Net.URI.
USING Progress.Json.ObjectModel.*.

DEFINE VARIABLE oClient AS IHttpClient NO-UNDO.
DEFINE VARIABLE oURI AS URI NO-UNDO.
DEFINE VARIABLE oRequest AS IHttpRequest NO-UNDO. 
DEFINE VARIABLE OResponse AS IHttpResponse NO-UNDO.
DEFINE VARIABLE oJsonObject AS JsonObject NO-UNDO.
DEFINE VARIABLE JsonString AS LONGCHAR NO-UNDO.

//Build a request
oURI = URI:Parse("http://oemobiledemo.progress.com/OEMobileDemoServices/rest/
CustomerService/Customer?filter=CustNum=1").
oRequest = RequestBuilder:GET(oURI):Request.

//Execute a request
oClient = ClientBuilder:Build():Client.
oResponse = oClient:Execute(oRequest).


//Process the response
IF oResponse:StatusCode <> 200 THEN
  RETURN ERROR "Request Error: " + STRING(oResponse:StatusCode).
ELSE
  DO:
    oJsonObject = CAST(oResponse:Entity, JsonObject).
    oJsonObject:Write(JsonString, true).
    MESSAGE string(JsonString).
  END.
The ClientBuilder:Build():Client method is the minimum you need to build an HTTP client; however, IHttpClient is a fluent interface, so you can add other methods in a method chain as shown in the following example:
oClient = ClientBuilder:Build()
			:ViaProxy(URI) 
			:KeepCookies(ICookieJar)
			:SetRequestTimeout(DECIMAL)
			:SetNumRetries(INTEGER)
			:Client.

Use the SetRequestTimeout() method to set a timeout value in seconds for the HTTP connection to be established. Use the SetNumRetries() method to set the number of attempts at making a connection.

Use a client library

The client object can also make use of a client library to set certain properties and behaviors. This client object follows the OpenEdge.Net.HTTP.IHttpClientLibrary interface and can be created using the OpenEdge.Net.HTTP.ClientLibraryBuilder class. The purpose of the library object is to set common options, many of which are related to secure HTTP communications such as SSL cyphers, SSL protocols, and TLS-supported groups. The library object can then be used by multiple IHttpClient object instances for consistent operation. The following example shows how to create and use a client library:

DEFINE VARIABLE oLib AS IHttpClientLibrary NO-UNDO.

oLib = ClientLibraryBuilder:Build()
				:SetRequestTimeout(DECIMAL)
				:Library.

oClient = ClientBuilder:Build()
			:ViaProxy(URI) 
			:KeepCookies(ICookieJar)
			:SetNumRetries(INTEGER)
			:UseLibrary(oLib)
			:Client.

Note in the above example that the created oClient object makes use of the client library via the UseLibrary(IHttpClientLibrary) method. The ClientLibraryBuilder class supports decoration of the generated Library object similar to the ClientBuilder. The builder class also offers a SetRequestTimeout() method which allows the client library to take precedence over any value set via the HTTP client instance itself.

You can use the client and client library objects to:

API reference documentation

To view the complete list of methods that you can use on a Client object, refer to the ClientBuilder reference documentation or see the OpenEdge.Net API Reference documentation.