OpenEdge.Net.HTTP.IHttpResponse
- Last Updated: August 24, 2026
- 1 minute read
- OpenEdge
- Version 12.2
- Documentation
Once a request successfully executes (note that success is defined as a successful round trip,
however a successful request may return undesired or unexpected results), an
IHttpResponse object is returned to the caller. The two most
important pieces of data this object returns are the StatusCode and
the Entity properties.
The Entity property has a defined type of
Progress.Lang.Object although the type of the object contained
in it is usually something more specialized. The response will convert text received
by an HTTP client into a JsonConstruct,
OpenEdge.Core.String or some other type, depending on the
ContentType of the response.
The StatusCode property indicates the result
of the request. These values can be enumerated by OpenEdge.Net.HTTP.StatusCodeEnum, which is based on https://www.rfc-editor.org/rfc/rfc9110.html#name-status-codes
Examples
Extracting typed data from a response
The sample code below retrieves the Entity and writes it to disk in
the correct format based on the type of the returned Entity. We can
also use the response's ContentType property to perform similar
operations.
Credentials and create the
temp folder where the output is written.
|
This example handles only JSON, XML, and OpenEdge.Core.String (text)
response-body objects. For text responses, it uses ContentType to
write the data to a file with an appropriate extension. The Entity
property is defined as the common Progress.Lang.Object type.
Applications should inspect the runtime object type and handle other entity types as
appropriate.
Status codes
The code sample below retrieves the StatusCode of a request and
displays it as a message in an alert box.
|