NAME
App::Dochazka::REST::Dispatch - path dispatch
VERSION
Version 0.097
DESCRIPTION
This module contains a single function, is_auth, that processes the "path" from the HTTP request.
is_auth
Takes three parameters: (1) the EID of the employee making the request, (2) the current privilege level of that EID, and (3) the path string. It returns a status object, the level of which can be either 'OK' (authorized) or 'NOT_OK'. If the request is authorized, the payload will contain a reference to a hash that will look like this:
{
rout => CODEREF,
args => [ ... ],
}
where 'rout' is a reference to the subroutine to be run to obtain the JSON string for the HTTP response, and 'args' is a list of arguments to be provided to that function.
REQUEST SYNTAX
Documentation of App::Dochazka::REST request syntax. Each section below corresponds to a URL, in which you should replace dochazka.site
with the FQDN of your own Dochazka REST server. The full URL is shown only for the first couple entries. All responses are JSON-encoded status objects unless otherwise noted.
http://dochazka.site/
(If this URL is opened in a browser, a HTML page will be displayed. The HTML source code is defined in $mesg->DOCHAZKA_REST_HTML
.)
This is considered an empty request. The response will be the same as for "/dochazka.site/version"" in "http:.
http://dochazka.site/version
Returns version number of the App::Dochazka::REST that is installed at the site. For example:
/VERSION example here
http://dochazka.site/help
Returns a hopefully helpful status object containing a URL where this documentation can be accessed.
/site/[PARAM]
(For the sake of brevity, the http://dochazka.site
part will be omitted from here on.)
Returns value of the given site param in the payload.
/lookup/...
Look up various objects in the database (needs: class)
/lookup/employee/...
Look up employees in the database (needs: search_key_type)
/lookup/employee/nick/[SEARCH_KEY]
Look up employees by nick