%pkg.isc.rest.handler
abstract class %pkg.isc.rest.handler extends %CSP.REST
Base REST handler for APIs built on %pkg.isc.rest. Consumers should extend this, override GetUserResource() and AuthenticationStrategy() appropriately, and should *NOT* override the UrlMap XData block.Method Inventory
- AuthenticationStrategy()
- BuildDocumentationEndpoint()
- CheckAllPermissions()
- CheckPermission()
- CheckResourcePermitted()
- CollectionQuery()
- ConsoleBuildOpenAPIDocumentation()
- Construct()
- Create()
- Delete()
- DispatchClassAction()
- DispatchInstanceAction()
- GetDocumentationBuildStatus()
- GetOpenAPISpecification()
- GetUserContext()
- GetUserInfo()
- GetUserResource()
- LogErrorStatus()
- LogOut()
- ModifyOpenAPISpecification()
- OnPreDispatch()
- ReportHttpStatusCode()
- Retrieve()
- SetLogLevel()
- Supports()
- Update()
Parameters
parameter APIVersion = 0.1.0;
Version of this API to be used in OpenAPI documentation
Formatting follows Semantic Versioning (https://semver.org/)
parameter CHARSET = utf-8;
Specifies the default character set for the page. This can be overriden using the
<CSP:CONTENT CHARSET=> tag, or by setting the %response.CharSet property
in the OnPreHTTP() method. If this parameter is not specified, then
for the default charset is utf-8.
parameter CONVERTINPUTSTREAM = 1;
Specifies if input %request.Content or %request.MimeData values are converted from their
original character set on input. By default (0) we do not modify these and receive them
as a binary stream which may need to be converted manually later. If 1 then if there
is a 'charset' value in the request Content-Type or mime section we will convert from this
charset when the input data is text based. For either json or xml data with no charset
this will convert from utf-8 or honor the BOM if one is present.
parameter QuerySelectMode = 0;
Determines what mode queries using this REST handler will be run in. Defaults to 0 (Logical Mode).
Overwrite in a subclass as 1 (ODBC Mode) or 2 (Display Mode).
final parameter SupportsCheckEndpoints;
Endpoints for which Supports() is called. Take a look at
the method documentation to see how this parameter is used.
Methods
abstract classmethod AuthenticationStrategy() as %Dictionary.Classname
Subclasses must override this to define a custom authentication strategy class.
final classmethod BuildDocumentationEndpoint() as %Status
Endpoint call to build all REST documentation types
Query parameters are:
debug (defaults to 0): Whether or not to run documentation generators in debug mode
internal (defaults to 0): Whether or not to generate documentation appropriate for users with source code access
final classmethod CheckAllPermissions(pResourceClass As %Dictionary.Classname, pID As %String, pOperation As %String, pUserContext As %String, ByRef pURLParams) as %Boolean
Checks both strategy- and resource-level permissions
classmethod CheckPermission(pEndpoint As %String, pUserContext As %RegisteredObject, ByRef pURLParams) as %Boolean
Checks the user's permission for a documentation-related endpoint.
pEndpoint may be one of:
- /build-documentation
- /openapi.json
classmethod CheckResourcePermitted(resourceClass As %Dictionary.Classname) as %Boolean
Subclasses MUST override this method to specify which resource classes are allowed
as part of the API.
final classmethod ConsoleBuildOpenAPIDocumentation(apiPath, debug=0, internal=0, Output response As %pkg.isc.rest.openAPI.model.openAPI, endpointOverride As %String = "") as %Status
Builds OpenAPI documentation from the console (no use of %request / %response)
apiPath is the application path of the form "/your/application/"
debug / internal are the same as the query parameters defined in BuildDocumentationEndpoint()
response will be set to the generated OpenAPI specification
Creates a new instance of the resource (handling a POST request to the resource's endpoint)
final classmethod DispatchInstanceAction(resourceName As %String, id As %String, action As %String) as %Status
final classmethod GetDocumentationBuildStatus() as %Status
Reports on the status of either the currently building documentation, or the last built documentation
final classmethod GetOpenAPISpecification() as %Status
Endpoint call to get the OpenAPI specification saved to disk, and write it to the page as JSON
final classmethod GetUserContext() as %pkg.isc.rest.model.resource
final classmethod GetUserInfo() as %Status
classmethod GetUserResource(pFullUserInfo As %DynamicObject) as %pkg.isc.rest.model.iSerializable
Subclasses may override this method to provide information about the logged-in user.
- pFullUserInfo: dynamic object with full user info provided by the authentication strategy
classmethod LogErrorStatus(pStatus As %Status)
Subclasses may override to customize logging.
To suppress error logging, set ^Config("isc","rest","suppressLogging") = 1
To suppress error logging, set ^Config("isc","rest","suppressLogging") = 1
final classmethod LogOut() as %Status
classmethod ModifyOpenAPISpecification(ByRef specification As %pkg.isc.rest.openAPI.model.openAPI)
Used to modify a generated OpenAPI specification before it is finalized, implement any custom-changes you want to make to
the OpenAPI specification as a whole here.
If you want to modify something class-specific (resource/action endpoints, schemas generated for classes), consider using the
ModifyOpenAPISpecification() ClassMethod of the class in question instead.
classmethod OnPreDispatch(pUrl As %String, pMethod As %String, ByRef pContinue As %Boolean) as %Status
This method Gets called prior to dispatch of the request. Put any common code here
that you want to be executed for EVERY request. If pContinue is set to 0, the
request will NOT be dispatched according to the UrlMap. If this case it's the
responsibility of the user to return a response.
Issue an 'Http' error
classmethod SetLogLevel(pLogLevel As %Integer = 0)
Errors are logged to the application error log, which is time- and space-intensive; use with care in production environments.
Possible values for pLogLevel:
- 0 (default): Log no errors
- 1: Log system errors only
- 2: Log all errors
classmethod Supports(pEndpoint As %String, pHTTPVerb As %String, pRequest As %CSP.Request = $$$NULLOREF) as %Boolean
Checks if the endpoint provided is supported for the current dispatch class.
If the method returns 0 for a given endpoint, requests to the endpoint will
get a 404 and the endpoint will be excluded from the Open API specification.
Default behavior is to return 1 for all endpoints.
pEndpoint can be one of the endpoint-http verb combinations present in SupportsCheckEndpoints.
pHTTPVerb is the HTTP verb for the endpoint.
pRequest is the request object in an HTTP context.
Default behavior is to return 1 for all endpoints.
pEndpoint can be one of the endpoint-http verb combinations present in SupportsCheckEndpoints.
pHTTPVerb is the HTTP verb for the endpoint.
pRequest is the request object in an HTTP context.
Inherited Members
Inherited Methods
- %ClassIsLatestVersion()
- %ClassName()
- %DispatchClassMethod()
- %DispatchGetModified()
- %DispatchGetProperty()
- %DispatchMethod()
- %DispatchSetModified()
- %DispatchSetMultidimProperty()
- %DispatchSetProperty()
- %Extends()
- %GetParameter()
- %IsA()
- %New()
- %OriginalNamespace()
- %PackageName()
- %SetModified()
- AcceptsContentType()
- AccessCheck()
- ConvertParameter()
- Decrypt()
- DispatchRequest()
- DrawCSS3STYLE()
- DrawHEAD()
- DrawSTHEAD()
- DrawSTTitle()
- DrawSTYLE()
- DrawTitle()
- DrawTitleSection()
- Encrypt()
- Error()
- EscapeHTML()
- EscapeURL()
- GetAuthChallenge()
- Http403()
- Http404()
- Http405()
- Http500()
- HyperEventCall()
- HyperEventHead()
- Include()
- InsertHiddenField()
- InsertHiddenFields()
- IsPrivate()
- Link()
- Login()
- OnErrorSetup()
- OnHTTPHeader()
- OnHandleCorsRequest()
- OnHandleOptionsRequest()
- OnLoginPage()
- OnPage()
- OnPageError()
- OnPostHTTP()
- OnPostHyperEvent()
- OnPreHTTP()
- OnPreHyperEvent()
- OnSecurityTokenPage()
- Page()
- QuoteJS()
- RewriteURL()
- SetResponseHeaderIfEmpty()
- ShowError()
- StartTimer()
- StatusToJSON()
- StatusToProxyObject()
- StopTimer()
- SupportedVerbs()
- ThrowError()
- UnescapeHTML()
- UnescapeURL()