HS.REST.Client

abstract class HS.REST.Client extends %Library.RegisteredObject

Defines a REST client. @API.Extensible

Method Inventory

Parameters

parameter CHARSETJSON = utf-8;
parameter CONTENTTYPEJSON = application/json;
parameter CONTENTTYPETEXT = text/plain;
parameter SSLConfigDescription = SSL Configuration to use for REST Client;
Description of SSL Configuration
parameter SSLConfigName;
Name of an SSL Configuration to use for https requests.

Methods

final method BuildAndSendJSONRequest(pMethod As %String, pRequestURL As %String, ByRef pQuery, ByRef pHeaders, ByRef pFormData, ByRef pRawData) as %DynamicAbstractObject
Builds and sends an http request of type pMethod to URL pRequestURL with optional URL parameters in pQuery, optional headers in pHeaders and optional body content in pFormData and pRawData.
Returns the body of the http response as a %DynamicAbstractObject object.
@Argument pMethod Type of the request (e.g. GET, PUT, etc.).
@Argument pRequestURL URL for the request.
@Argument pQuery Optional subscripted array with key-value pairs corresponding to URL parameter key-value pairs (i.e. parameters after ? in the URL).
@Argument pHeaders Optional subscripted array with key-value pairs corresponding to headers of the request (e.g. ContentType, Authorization, etc.) @Argument pFormData Optional form data as a subscripted array of key-value pairs for the body of the request.
@Argument pRawData Optional raw data as a %String or %DynamicAbstractObject for the body of the request.
final method BuildAndSendRequest(pMethod As %String, pRequestURL As %String, ByRef pQuery, ByRef pHeaders, ByRef pFormData, ByRef pRawData As %String) as %Net.HttpRequest
Builds and sends an http request of type pMethod to URL pRequestURL with optional URL parameters in pQuery, optional headers in pHeaders and optional body content in pFormData and pRawData.
Returns the http request that was built, with the resulting http response embedded in it.
@Argument pMethod Type of the request (e.g. GET, PUT, etc.).
@Argument pRequestURL URL for the request.
@Argument pQuery Optional subscripted array with key-value pairs corresponding to URL parameter key-value pairs (i.e. parameters after ? in the URL).
@Argument pHeaders Optional subscripted array with key-value pairs corresponding to headers of the request (e.g. ContentType, Authorization, etc.) @Argument pFormData Optional form data as a subscripted array of key-value pairs for the body of the request.
@Argument pRawData Optional raw data as a %String for the body of the request.
final classmethod CreateSSLConfig()
Creates an SSL Config to be used for https requests.
final method Delete(pRequestURL As %String, ByRef pQuery, ByRef pHeaders, ByRef pFormData, ByRef pRawData As %String) as %Net.HttpRequest
Does a DELETE http request as a wrapper around BuildAndSendRequest().
@API.Method @Argument pRequestURL URL for the request.
@Argument pQuery Optional subscripted array with key-value pairs corresponding to URL parameter key-value pairs (i.e. parameters after ? in the URL).
@Argument pHeaders Optional subscripted array with key-value pairs corresponding to headers of the request (e.g. ContentType, Authorization, etc.) @Argument pFormData Optional form data as a subscripted array of key-value pairs for the body of the request.
@Argument pRawData Optional raw data as a %String for the body of the request.
final method DeleteJSON(pRequestURL As %String, ByRef pQuery, ByRef pHeaders, ByRef pFormData, ByRef pRawData) as %DynamicAbstractObject
Does a DELETE http request as a wrapper around BuildAndSendJSONRequest().
@API.Method @Argument pRequestURL URL for the request.
@Argument pQuery Optional subscripted array with key-value pairs corresponding to URL parameter key-value pairs (i.e. parameters after ? in the URL).
@Argument pHeaders Optional subscripted array with key-value pairs corresponding to headers of the request (e.g. ContentType, Authorization, etc.) @Argument pFormData Optional form data as a subscripted array of key-value pairs for the body of the request.
@Argument pRawData Optional raw data as a %String or %DynamicAbstractObject for the body of the request.
classmethod GenerateInstallerClass()
Method to generate installer classes for subclasses. Any module that contains a subclass of this class, must either use this installer class or create its own and call CreateSSLConfig() in the installer class's method OnInstallComponent()
final method Get(pRequestURL As %String, ByRef pQuery, ByRef pHeaders) as %Net.HttpRequest
Does a GET http request as a wrapper around BuildAndSendRequest().
@API.Method @Argument pRequestURL URL for the request.
@Argument pQuery Optional subscripted array with key-value pairs corresponding to URL parameter key-value pairs (i.e. parameters after ? in the URL).
@Argument pHeaders Optional subscripted array with key-value pairs corresponding to headers of the request (e.g. ContentType, Authorization, etc.)
final method GetJSON(pRequestURL As %String, ByRef pQuery, ByRef pHeaders) as %DynamicAbstractObject
Does a GET http request as a wrapper around BuildAndSendJSONRequest().
@API.Method @Argument pRequestURL URL for the request.
@Argument pQuery Optional subscripted array with key-value pairs corresponding to URL parameter key-value pairs (i.e. parameters after ? in the URL).
@Argument pHeaders Optional subscripted array with key-value pairs corresponding to headers of the request (e.g. ContentType, Authorization, etc.)
method OnBuildRequest(pRequest As %Net.HttpRequest)
Allows customization of headers (etc.) for each request - for example, adding authorization.
@API.Overrideable @Argument pRequest The HTTP request object to be configured
method OnUnauthorized() as %Boolean
This method can be overriden to provide any authorization logic for when a 401 Unauthorized status code is returned.
Returns 1 if the user is authorized, else 0
@API.Overrideable
final method Post(pRequestURL As %String, ByRef pQuery, ByRef pHeaders, ByRef pFormData, ByRef pRawData As %String) as %Net.HttpRequest
Does a POST http request as a wrapper around BuildAndSendRequest().
@API.Method @Argument pRequestURL URL for the request.
@Argument pQuery Optional subscripted array with key-value pairs corresponding to URL parameter key-value pairs (i.e. parameters after ? in the URL).
@Argument pHeaders Optional subscripted array with key-value pairs corresponding to headers of the request (e.g. ContentType, Authorization, etc.) @Argument pFormData Optional form data as a subscripted array of key-value pairs for the body of the request.
@Argument pRawData Optional raw data as a %String for the body of the request.
final method PostJSON(pRequestURL As %String, ByRef pQuery, ByRef pHeaders, ByRef pFormData, ByRef pRawData) as %DynamicAbstractObject
Does a POST http request as a wrapper around BuildAndSendJSONRequest().
@API.Method @Argument pRequestURL URL for the request.
@Argument pQuery Optional subscripted array with key-value pairs corresponding to URL parameter key-value pairs (i.e. parameters after ? in the URL).
@Argument pHeaders Optional subscripted array with key-value pairs corresponding to headers of the request (e.g. ContentType, Authorization, etc.) @Argument pFormData Optional form data as a subscripted array of key-value pairs for the body of the request.
@Argument pRawData Optional raw data as a %String or %DynamicAbstractObject for the body of the request.
final method Put(pRequestURL As %String, ByRef pQuery, ByRef pHeaders, ByRef pFormData, ByRef pRawData As %String) as %Net.HttpRequest
Does a PUT http request as a wrapper around BuildAndSendRequest().
@API.Method @Argument pRequestURL URL for the request.
@Argument pQuery Optional subscripted array with key-value pairs corresponding to URL parameter key-value pairs (i.e. parameters after ? in the URL).
@Argument pHeaders Optional subscripted array with key-value pairs corresponding to headers of the request (e.g. ContentType, Authorization, etc.) @Argument pFormData Optional form data as a subscripted array of key-value pairs for the body of the request.
@Argument pRawData Optional raw data as a %String for the body of the request.
final method PutJSON(pRequestURL As %String, ByRef pQuery, ByRef pHeaders, ByRef pFormData, ByRef pRawData) as %DynamicAbstractObject
Does a PUT http request as a wrapper around BuildAndSendJSONRequest().
@API.Method @Argument pRequestURL URL for the request.
@Argument pQuery Optional subscripted array with key-value pairs corresponding to URL parameter key-value pairs (i.e. parameters after ? in the URL).
@Argument pHeaders Optional subscripted array with key-value pairs corresponding to headers of the request (e.g. ContentType, Authorization, etc.) @Argument pFormData Optional form data as a subscripted array of key-value pairs for the body of the request.
@Argument pRawData Optional raw data as a %String or %DynamicAbstractObject for the body of the request.

Inherited Members

Inherited Methods

Feedback