internal package Foswiki::UI::Rest
On this page:
internal package Foswiki::UI::Rest
UI delegate for REST interface
StaticMethod registerRESTHandler( $subject, $verb, \&fn, %options )
Adds a function to the dispatch table of the REST interface
for a given subject. See CommandAndCGIScripts#rest for more info.
-
$subject- The subject under which the function will be registered. -
$verb- The verb under which the function will be registered. -
\&fn- Reference to the function.
sub handler(\%session, $subject, $verb) -> $textwhere:
-
\%session- a reference to the Foswiki session object (may be ignored) -
$subject- The invoked subject (may be ignored) -
$verb- The invoked verb (may be ignored)
%options hash. These options are important
to ensuring that requests to your handler can't be used in cross-scripting
attacks, or used for phishing. -
authenticate- use this boolean option to require authentication for the handler. If this is set, then an authenticated session must be in place or the REST call will be rejected with a 401 (Unauthorized) status code. By default, rest handlers do not require authentication. -
validate- use this boolean option to require validation of any requests made to this handler. By default, requests made to REST handlers are not validated. -
http_allowuse this option to specify the HTTP methods that can be used to invoke the handler.