HS.FHIRServer.RestClient.HTTP
class HS.FHIRServer.RestClient.HTTP extends HS.FHIRServer.RestClient.Base
This class provides API methods for creating and submitting FHIR REST API calls directly over HTTP.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 Service Registry HTTP entry.
- The %OAuthSendType property is specific to this class.
- All input content body (payloads) must be stream or string, already formatted in the desired format.
- Internally, requests are invoked via %Net.HttpRequest.
Example usage:
Set clientObj = ##class(HS.FHIRServer.RestClient.HTTP).CreateInstance("MyFHIR.HTTP.Service")
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).
Property Inventory
Method Inventory
- CreateInstance()
- InvokeRequest()
- MakeClientResponseFromResponse()
- MakeRequest()
- OAuthSendTypeGet()
- SetRequestFormat()
- SetResponseFormat()
Properties
property OAuthSendType as %String [ Calculated ];
OAuth 2.0 send type (header, body, query) to determine where in an HTTP request to place an OAuth 2.0 access token.
Property methods: OAuthSendTypeDisplayToLogical(), OAuthSendTypeIsValid(), OAuthSendTypeLogicalToDisplay(), OAuthSendTypeLogicalToOdbc(), OAuthSendTypeNormalize()
Methods
classmethod CreateInstance(pServiceName As %String, pPrefer As %String = "", pSessionId As %String = "", pOAuthClientName As %String = "", pOAuthToken="", pOAuthSendType As %String = "header") as HS.FHIRServer.RestClient.HTTP
@API
All of the input values constitute inputs/parameters that will be constant for all interactions invoked by this object instance.
@Input pServiceName Name of Service Registry HTTP entry.
@Input pPrefer Prefer header value.
@Input pSessionId Typically a CSP session id. Used in conjunction with OAuthClientName for retrieving an established OAuth 2.0 access token to add to the request.
@Input pOAuthClientName Used in conjunction with SessionId for retrieving an OAuth 2.0 access token to add to the request.
@Input pOAuthToken OAuth 2.0 access token, provided directly as opposed to retrieving via SessionId+OAuthClientName.
@Input pOAuthSendType OAuth 2.0 send type (header, body, query) to determine where in an HTTP request to place an OAuth 2.0 access token.
All of the input values constitute inputs/parameters that will be constant for all interactions invoked by this object instance.
@Input pServiceName Name of Service Registry HTTP entry.
@Input pPrefer Prefer header value.
@Input pSessionId Typically a CSP session id. Used in conjunction with OAuthClientName for retrieving an established OAuth 2.0 access token to add to the request.
@Input pOAuthClientName Used in conjunction with SessionId for retrieving an OAuth 2.0 access token to add to the request.
@Input pOAuthToken OAuth 2.0 access token, provided directly as opposed to retrieving via SessionId+OAuthClientName.
@Input pOAuthSendType OAuth 2.0 send type (header, body, query) to determine where in an HTTP request to place an OAuth 2.0 access token.
method InvokeRequest(pRequest As %RegisteredObject, pRequestMethod As %String, pRequestPath As %String, pQueryString As %String) as %RegisteredObject
@API.Overridable
InvokeRequest takes the Private %HttpRequest object - passed in as pRequest here - and invokes the request. The HTTP response is stored as the HttpResponse property of the HTTP request object. This method returns a reference to that property.
@Input pRequest %Net.HttpRequest object.
@Input pRequestMethod HTTP verb.
@Input pPayload Input payload content, can be FHIR resource content or Patch content.
@Input pRequestPath Request path, as derived by the invoked interaction-specific method.
@Input pQueryString Query string, as derived by the invoked interaction-specific method.
InvokeRequest takes the Private %HttpRequest object - passed in as pRequest here - and invokes the request. The HTTP response is stored as the HttpResponse property of the HTTP request object. This method returns a reference to that property.
@Input pRequest %Net.HttpRequest object.
@Input pRequestMethod HTTP verb.
@Input pPayload Input payload content, can be FHIR resource content or Patch content.
@Input pRequestPath Request path, as derived by the invoked interaction-specific method.
@Input pQueryString Query string, as derived by the invoked interaction-specific method.
method MakeClientResponseFromResponse(pResponse As %RegisteredObject) as HS.FHIRServer.API.Data.RestClient.Response
@API.Overridable
MakeClientResponseFromResponse takes the HTTP response object, creates a HS.FHIRServer.API.Data.RestClient.Response object from it, and returns that object.
@Input pResponse %Net.HttpRequest.HttpResponse object.
MakeClientResponseFromResponse takes the HTTP response object, creates a HS.FHIRServer.API.Data.RestClient.Response object from it, and returns that object.
@Input pResponse %Net.HttpRequest.HttpResponse object.
method MakeRequest(pRequestMethod As %String, pPayload, pRequestPath As %String, pQueryString As %String, ByRef pHeaders) as %RegisteredObject
@API.Overridable
MakeRequest creates a %Net.HttpRequest object from the user input that was derived from the interaction-specific method that received it, holds the HTTP request object as the Private class property ..%HttpRequest, and returns a reference to that object.
@Input pRequestMethod HTTP verb.
@Input pPayload Input payload content, can be FHIR resource content or Patch content.
@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.
MakeRequest creates a %Net.HttpRequest object from the user input that was derived from the interaction-specific method that received it, holds the HTTP request object as the Private class property ..%HttpRequest, and returns a reference to that object.
@Input pRequestMethod HTTP verb.
@Input pPayload Input payload content, can be FHIR resource content or Patch content.
@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 OAuthSendTypeGet() as %String
method SetRequestFormat(pFHIRFormatCode As %String = "", pCharset As %String = "UTF-8", pFHIRVersion As %String = "")
@API
Set the Content-Type header value for the request.
@Input pFHIRFormatCode Code indicating the requested mime type. Valid values are blank, JSON, XML, Form, JPatch, and XPatch.
@Input pCharset charset parameter value for Content-Type header. May be suppressed by explicitly specifying blank string.
@Input pFHIRVersion fhirVersion parameter value for Content-Type header. May be a release code (e.g., R4) or version number (e.g. 4.0).
Set the Content-Type header value for the request.
@Input pFHIRFormatCode Code indicating the requested mime type. Valid values are blank, JSON, XML, Form, JPatch, and XPatch.
@Input pCharset charset parameter value for Content-Type header. May be suppressed by explicitly specifying blank string.
@Input pFHIRVersion fhirVersion parameter value for Content-Type header. May be a release code (e.g., R4) or version number (e.g. 4.0).
method SetResponseFormat(pFHIRFormatCode As %String = "", pCharset As %String = "UTF-8", pFHIRVersion As %String = "")
@API
Set the Accept header value for the request.
@Input pFHIRFormatCode Code indicating the requested mime type. Valid values are blank, JSON, and XML.
@Input pCharset charset parameter value for Accept header. May be suppressed by explicitly specifying blank string.
@Input pFHIRVersion fhirVersion parameter value for Accept header. May be a release code (e.g., R4) or version number (e.g. 4.0).
Set the Accept header value for the request.
@Input pFHIRFormatCode Code indicating the requested mime type. Valid values are blank, JSON, and XML.
@Input pCharset charset parameter value for Accept header. May be suppressed by explicitly specifying blank string.
@Input pFHIRVersion fhirVersion parameter value for Accept header. May be a release code (e.g., R4) or version number (e.g. 4.0).
Inherited Members
Inherited Properties
Inherited Methods
- %AddToSaveSet()
- %ClassIsLatestVersion()
- %ClassName()
- %ConstructClone()
- %DispatchClassMethod()
- %DispatchGetModified()
- %DispatchGetProperty()
- %DispatchMethod()
- %DispatchSetModified()
- %DispatchSetMultidimProperty()
- %DispatchSetProperty()
- %Extends()
- %GetParameter()
- %IsA()
- %IsModified()
- %New()
- %NormalizeObject()
- %ObjectModified()
- %OriginalNamespace()
- %PackageName()
- %RemoveFromSaveSet()
- %SerializeObject()
- %SetModified()
- %ValidateObject()
- Batch()
- ClearOtherRequestHeaders()
- ConditionalCreate()
- ConditionalDelete()
- ConditionalPatch()
- ConditionalRead()
- ConditionalUpdate()
- Create()
- Delete()
- GetOtherRequestHeader()
- History()
- Metadata()
- OAuthClientNameGet()
- OAuthTokenGet()
- Operation()
- Patch()
- PreferGet()
- Read()
- RequestFormatGet()
- ResponseFormatGet()
- Search()
- ServiceNameGet()
- SessionIdGet()
- SetOtherRequestHeaders()
- Update()
- VRead()