HSMOD.REST.Base
class HSMOD.REST.Base extends %CSP.REST
Base class for REST APIs in applications and modules @API.Extensible @Modifier Availability InterSystemsMethod Inventory
- %Identity()
- %Namespace()
- %Ping()
- %Version()
- CheckSinglePermission()
- ExtractServerError()
- GenerateCsrfSessionToken()
- HandleRESTRequestResponseProblem()
- Login()
- ManageSessionVerification()
- OnPreDispatch()
- OutputServerErrorToJSON()
- SimpleRESTRequestResponse()
- VerifySession()
- checkPermissions()
- httpStatusResponse()
Parameters
Methods
Callback method that is called whenever a problem arises in the validation steps of SimpleRESTRequestResponse(). It is passed a (custom) %Status code that indicates what went wrong, as well as an HTTP response string that seems appropriate. We also pass in the names of the specified API class and method, to provide context.
Return value is a %Status value that will be used as the return value of SimpleRESTRequestResponse().
This method, or its overrides, must return a value for the helper method to use as its return value, and also populate %response.Status.
Default implementation is to:
- log the %Status argument to the Ensemble event log
- populate the %status.Response value with the provided HTTP response string value
- return $$$OK
- pAPIClassName: the name of the class containing the method we should call to do the work. If omitted, we use the value of SIMPLEAPICLASSNAME instead. If both are empty, we assume it's the current class name.
- pAPIMethodName: the name of the method in the "report class" we will call. Assumed to have a signature consisting solely of the request object and an output argument for the response object, and to return a %Status.
- pRequestClassName: the name of the class we expect to find in the %request object. If omitted, we validate the class using the method signature.
- pResponseClassName: the name of the expected response class. If omitted, we validate the class using the method signature.
- pDisableMethodSignatureValidation: if set to 1, this turns off our validation of the method signature. Use at your own risk!
- pHandledValidationError: if a validation error occurred (either with the method signature or with one of the objects), the relevant status code is returned here in case the caller code wants to interrogate it. Normally this is not necessary, because we have already logged it and set the %response.Status accordingly, but it is provided here for transparency. Most REST endpoint methods calling this helper method will not need to examine it, and can omit it from the call.
This method validates that the specified API class method exists and has the expected signature (one request object in, one request object out). It also validates the request object as an instance of the expected request object type, and likewise it validates the response object. If a problem is detected in this area, the method returns a custom internal error code and sets the %response.Status to "400" or "500". Extension classes can also customize the handling of validation errors by overriding HandleRESTRequestResponseProblem().
If an error occurred during the call to the specified code API method, an error status will be returned and the %response.Status will be 500.
Inherited Members
Inherited Methods
- %ClassIsLatestVersion()
- %ClassName()
- %DispatchClassMethod()
- %DispatchGetModified()
- %DispatchGetProperty()
- %DispatchMethod()
- %DispatchSetModified()
- %DispatchSetMultidimProperty()
- %DispatchSetProperty()
- %Extends()
- %GetParameter()
- %IsA()
- %New()
- %OriginalNamespace()
- %PackageName()
- %SetModified()
- AcceptsContentType()
- AccessCheck()
- ConvertParameter()
- Decrypt()
- DispatchMap()
- DispatchRequest()
- DrawCSS3STYLE()
- DrawHEAD()
- DrawSTHEAD()
- DrawSTTitle()
- DrawSTYLE()
- DrawTitle()
- DrawTitleSection()
- Encrypt()
- Error()
- EscapeHTML()
- EscapeURL()
- GetAuthChallenge()
- Http403()
- Http404()
- Http405()
- Http500()
- HyperEventCall()
- HyperEventHead()
- Include()
- InsertHiddenField()
- InsertHiddenFields()
- IsPrivate()
- Link()
- OnErrorSetup()
- OnHTTPHeader()
- OnHandleCorsRequest()
- OnHandleOptionsRequest()
- OnLoginPage()
- OnPage()
- OnPageError()
- OnPostHTTP()
- OnPostHyperEvent()
- OnPreHTTP()
- OnPreHyperEvent()
- OnSecurityTokenPage()
- Page()
- QuoteJS()
- ReportHttpStatusCode()
- ResolveTarget()
- RewriteURL()
- SetResponseHeaderIfEmpty()
- ShowError()
- StartTimer()
- StatusToJSON()
- StatusToProxyObject()
- StopTimer()
- SupportedVerbs()
- ThrowError()
- UnescapeHTML()
- UnescapeURL()