Skip to main content

class extends %CSP.REST

Base REST handler for APIs built on Consumers should extend this, override GetUserResource() and AuthenticationStrategy() appropriately, and should *NOT* override the UrlMap XData block.

Method Inventory


parameter APIVersion = 0.1.0;
Version of this API to be used in OpenAPI documentation Formatting follows Semantic Versioning (
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.
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.


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
pUserContext is supplied by GetUserContext().
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 CollectionQuery(resourceName As %String) as %Status
final classmethod ConsoleBuildOpenAPIDocumentation(apiPath, debug=0, internal=0, Output response As, 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
final classmethod Construct(resourceName As %String) as %Status
final classmethod Create(resourceName As %String) as %Status
Creates a new instance of the resource (handling a POST request to the resource's endpoint)
final classmethod Delete(resourceName As %String, id As %String) as %Status
final classmethod DispatchClassAction(resourceName As %String, action As %String) as %Status
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
final classmethod GetUserInfo() as %Status
classmethod GetUserResource(pFullUserInfo As %DynamicObject) as
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
    final classmethod LogOut() as %Status
    classmethod ModifyOpenAPISpecification(ByRef specification As
    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.
    classmethod ReportHttpStatusCode(pHttpStatus, pSC As %Status = $$$OK) as %Status
    Issue an 'Http' error
    final classmethod Retrieve(resourceName As %String, id As %String) as %Status
    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.
    final classmethod Update(resourceName As %String, id As %String) as %Status

    Inherited Members

    Inherited Methods


    FeedbackOpens in a new tab