Skip to main content

%REST.Impl

Class %REST.Impl Extends %RegisteredObject [ System = 4 ]

Abstract superclass for REST implementation classes generated from OpenAPI specifications.

Parameters

ExposeServerExceptions

Parameter ExposeServerExceptions = 0;

If ExposeServerExceptions is overridden as true, then details of internal errors will be exposed.

Methods

%SetStatusCode

ClassMethod %SetStatusCode(statusCode As %String)

The HTTP Status code to be sent back in the response. The HTTP status codes are defined in RFC 2068.

http://www.faqs.org/rfcs/rfc2068.html

%SetContentType

ClassMethod %SetContentType(contentType As %String)

Set the content-type header of the response

%GetContentType

ClassMethod %GetContentType()

Get the content-type header of the request

%SetHeader

ClassMethod %SetHeader(name As %String, value As %String)

Sets a custom HTTP header into the reply. If you set the same header twice it will append the information to the first with a ',' between them. Note that name is not case sensitive, however we will remember the case of the header when sending this to the client.

%SetCookieFromHeader

ClassMethod %SetCookieFromHeader(cookie As %String)

Sets a custom HTTP Cookie into the reply. Takes the value of a Set-Cookie header as a String and parses out its properties. These include name,value,expires,path,etc... Created for use with WSGI.

%SetHeaderIfEmpty

ClassMethod %SetHeaderIfEmpty(name As %String, value As %String) As %Boolean

Helper method that sets a header if it is currently empty, if it already has a value it does nothing. Returns true if the header was set and false if it did nothing.

%GetHeader

ClassMethod %GetHeader(name As %String) As %String

Return the value of the name request header. Note that name is not case sensitive

%DeleteHeader

ClassMethod %DeleteHeader(name As %String)

Remove a header from the response. Note that name is not case sensitive

%ReportRESTError

ClassMethod %ReportRESTError(statusCode As %String, sc As %Status, exposeServerExceptions As %Boolean = 0)

Report an error when processing a request. The implementation class may contain an override of %ReportRESTError in order to format the error response as required by the REST application. The override should use the %WriteResponse method to return the error response.

%CheckAccepts

ClassMethod %CheckAccepts(produces As %String) As %Boolean

Check that the ACCEPT request header is included in the produces list.

%WriteResponse

ClassMethod %WriteResponse(response)

%WriteResponse is used by the dispatch class to write the response to this request.

%LogError

ClassMethod %LogError(methodName As %String, error As %String, data As %String)

Log an API Management error

%CheckUniqueArray

ClassMethod %CheckUniqueArray(array As %ListOfDataTypes) As %Boolean [ Internal ]

Check that all items of an array are unique.