Skip to main content

HS.FHIRServer.RestClient.FHIRService

class HS.FHIRServer.RestClient.FHIRService extends HS.FHIRServer.RestClient.Base

This class provides API methods for creating and submitting FHIR REST API calls to a local FHIRServer Service.
HS.FHIRServer.RestClient.Base holds the primary implementation of all of the interaction-specific instance methods and properties.
Behavior specific to this class:
- The %ServiceName property refers to the name of a FHIRServer Service, which is the URL end point of the Service.
- The %BaseURL property is specific to this class.
- Input content body (payloads) can be stream or string (already formatted in the desired format), or can be %DynamicObject or FHIRObject.
- Internally, requests are invoked via a FHIRServer Service instance.

Example usage:
Set clientObj = ##class(HS.FHIRServer.RestClient.FHIRService).CreateInstance("/csp/healthshare/fhirserver/fhir/r4")
Do clientObj.SetResponseFormat("JSON")
Set clientResponseObj = clientObj.Read("GET", "Patient", "123")

See HS.FHIRServer.API.Data.RestClient.Response for details on the contents of the client response object (clientResponseObj in the above example).

Method Inventory

Methods

method BaseURLGet() as %String
classmethod CreateInstance(pServiceName As %String, pPrefer As %String = "", pSessionId As %String = "", pOAuthClientName As %String = "", pOAuthToken="", pBaseURL As %String = "") as HS.FHIRServer.RestClient.FHIRService
@API
Create and return an object instance of this class. All of the input values constitute inputs/parameters that will be constant for all interactions invoked by the returned object instance.
@Input pServiceName Name of a FHIRServer Service, which is the URL end point of the Service.
@Input pPrefer Prefer header value.
@Input pSessionId Typically a CSP session id. Used in conjunction with pOAuthClientName for retrieving an established OAuth 2.0 access token to add to a request.
@Input pOAuthClientName Used in conjunction with SessionId for retrieving an OAuth 2.0 access token to add to a request.
@Input pOAuthToken OAuth 2.0 access token, provided directly as opposed to retrieving via SessionId+OAuthClientName.
@Input pBaseURL BaseURL to use for formulating returned fullUrls and Location values. If not specified, then a value is derived using the current host name and default IRIS instance web server port plus the FHIRServer Service end point URL.
method InvokeRequest(pRequest As %RegisteredObject, pRequestMethod As %String, pRequestPath As %String, pQueryString As %String) as %RegisteredObject
@API.Overridable
InvokeRequest takes the HS.FHIRServer.API.Data.Request object - passed in as pRequest here - and invokes the FHIRServer Service, passing in the request object. It then returns the HS.FHIRServer.API.Data.Response object that was returned by the FHIRServer Service.
@Input pRequest HS.FHIRServer.API.Data.Request object.
@Input pRequestMethod (not used)
@Input pRequestPath (not used)
@Input pQueryString (not used)
method MakeClientResponseFromResponse(pResponse As %RegisteredObject) as HS.FHIRServer.API.Data.RestClient.Response
@API.Overridable
MakeClientResponseFromResponse takes the HS.FHIRServer.API.Data.Response response object, creates a HS.FHIRServer.API.Data.RestClient.Response object from it, and returns that object.
The content payload of the client response, when present, will always be a %DynamicObject, held in the 'Json' property. A helper instance method 'MakeStreamFromJSON' is provided on this class to faciliate serializing the %DynamicObject.
@Input pResponse HS.FHIRServer.API.Data.Response object.
method MakeRequest(pRequestMethod As %String, pPayload, pRequestPath As %String, pQueryString As %String, ByRef pHeaders) as %RegisteredObject
@API.Overridable
MakeRequest creates a HS.FHIRServer.API.Data.Request object from the user input that was derived from the interaction-specific method that received it, and returns that object.
@Input pRequestMethod HTTP verb.
@Input pPayload Input payload content, can be stream or string (already formatted in the desired format), or can be %DynamicObject or FHIRObject.
@Input pRequestPath Request path, as derived by the invoked interaction-specific method.
@Input pQueryString Query string, as derived by the invoked interaction-specific method.
@Input pHeaders Headers multidimensional, as derived from specific input parameters of the invoked interaction-specific method.
method MakeStreamFromJson(Json As %Library.DynamicObject, pretty As %Boolean = 0) as %Stream.Object
@API
Utility method to facilitate creating a stream from the client response Json (%DynamicObject) content, using the current property values of the current REST client object. The client response object includes a property 'IsPrettyOut' that may be passed in as the 'pretty' input parameter here. This method will honor the Private %ResponseFormat property of this class.
@API
Handle a FHIRServer search interaction request. This override does not move the query string to the payload upon POST.
@Input pRequestMethod (required) HTTP verb, must be "HEAD" or "GET" or "POST".
@Input pResourceType FHIR resource type.
@Input pCompartment Compartment name for compartment-based search.
@Input pResourceId FHIR resource id.
@Input pQueryString Query parameters string.
FHIR specification: http://hl7.org/fhir/http.html#search, http://hl7.org/fhir/search.html
method SetRequestFormat(pFHIRFormatCode As %String = "")
@API
Set the RequestFormatCode value for the request.
@Input pFHIRFormatCode Code indicating the requested mime type. Valid values are blank, JSON, XML, Form, JPatch, and XPatch.
method SetResponseFormat(pFHIRFormatCode As %String = "")
@API
Set the ResponseFormatCode value for the request.
@Input pFHIRFormatCode Code indicating the requested mime type. Valid values are blank, JSON, and XML.

Inherited Members

Inherited Properties

Inherited Methods

FeedbackOpens in a new tab