App-Dochazka-REST
view release on metacpan or search on metacpan
lib/App/Dochazka/REST/ResourceDefs.pm view on Meta::CPAN
=item * PUT
Inserts new or updates existing activity object whose code is specified by the
':code' URI parameter. The fields to be updated and their new values should be
sent in the request body, e.g., like this:
{ "long_desc" : "new description", "disabled" : "f" }
=item * DELETE
Deletes an activity object by its code whose code is specified by the ':code'
URI parameter. This will work only if nothing in the database refers to this
activity.
=back
EOH
},
};
=head2 Component resources
=cut
$defs->{'component'} = {
# /component
'component' =>
{
parent => '/',
handler => 'handler_noop',
acl_profile => 'passerby',
cli => 'component',
description => 'Parent for component resources',
documentation => <<'EOH',
=pod
Parent for component resources
EOH
},
# /component/all
'component/all' =>
{
parent => 'component',
handler => {
GET => 'handler_get_component_all',
},
acl_profile => 'admin',
cli => 'component all',
description => 'Retrieve all component objects',
documentation => <<'EOH',
=pod
Retrieves all component objects in the database.
EOH
},
# /component/cid
'component/cid' =>
{
parent => 'component',
handler => {
POST => 'handler_post_component_cid',
},
acl_profile => 'admin',
cli => 'component cid',
description => 'Update an existing component object via POST request (cid must be included in request body)',
documentation => <<'EOH',
=pod
Enables existing component objects to be updated by sending a POST request to
the REST server. Along with the properties to be modified, the request body
must include an 'cid' property, the value of which specifies the cid to be
updated.
EOH
},
# /component/cid/:cid
'component/cid/:cid' =>
{
parent => 'component',
handler => {
GET => 'handler_component_cid',
PUT => 'handler_component_cid',
DELETE => 'handler_component_cid',
},
acl_profile => 'admin',
cli => 'component cid $cid',
validations => {
'cid' => 'Int',
},
description => 'GET, PUT, or DELETE an component object by its cid',
documentation => <<'EOH',
=pod
This resource allows the user to GET, PUT, or DELETE an component object by its
cid.
=over
=item * GET
Retrieves an component object by its cid.
=item * PUT
Updates the component object whose cid is specified by the ':cid' URI parameter.
The fields to be updated and their new values should be sent in the request
body, e.g., like this:
{ "path" : "new/path", "source" : "new source", "acl" : "inactive" }
=item * DELETE
Deletes the component object whose cid is specified by the ':cid' URI parameter.
This will work only if nothing in the database refers to this component.
=back
EOH
},
# /component/path
'component/path' =>
{
parent => 'component',
handler => {
POST => 'handler_post_component_path',
},
acl_profile => 'admin',
cli => 'component cid',
description => 'Update an existing component object via POST request (component path must be included in request body)',
documentation => <<'EOH',
=pod
This resource enables existing component objects to be updated, and new
component objects to be inserted, by sending a POST request to the REST server.
Along with the properties to be modified/inserted, the request body must
include an 'path' property, the value of which specifies the component to be
updated.
EOH
},
};
=head2 Employee resources
=cut
$defs->{'employee'} = {
# /employee
'employee' =>
{
parent => '/',
handler => 'handler_noop',
acl_profile => 'passerby',
cli => 'employee',
description => 'Parent for employee resources',
documentation => <<'EOH',
=pod
Parent for employee resources
EOH
},
# /employee/count/?:priv
'employee/count/?:priv' =>
{
parent => 'employee',
handler => {
GET => 'handler_get_employee_count',
},
acl_profile => 'admin',
cli => 'employee count',
validations => {
'priv' => $priv_validation,
},
description => 'Display total count of employees (optionally by privlevel)',
documentation => <<'EOH',
=pod
If ':priv' is not specified, gets the total number of employees in the
database. This includes employees of all privilege levels, including not only
administrators and active employees, but inactives and passerbies as well.
If ':priv' is specified, gets the total number of employees with the
given privlevel. Valid privlevels are:
=over
( run in 0.795 second using v1.01-cache-2.11-cpan-39bf76dae61 )