Difference between revisions of "API:EPrints/Apache/REST"
(Created page with "<!-- Pod2Wiki=_preamble_ This page has been automatically generated from the EPrints 3.4 source. Any wiki changes made between the 'Pod2Wiki=*' and 'Edit below this comment'...") |
|||
(One intermediate revision by the same user not shown) | |||
Line 52: | Line 52: | ||
$rc = EPrints::Apache::REST::redir_add_slash( $repository ) | $rc = EPrints::Apache::REST::redir_add_slash( $repository ) | ||
− | Redirect to the current request for the $repository with an added slash | + | Redirect to the current request for the <tt>$repository</tt> with an added slash <tt>/</tt> at the end of the path. |
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 64: | Line 64: | ||
===serve_top_level=== | ===serve_top_level=== | ||
− | $rc = EPrints::Apache:: | + | $rc = EPrints::Apache::REST::serve_top_level( $repository, @path ) |
− | Serve top level list of datasets (i.e. eprint, user and subject) or | + | Serve top level list of datasets (i.e. <tt>eprint</tt>, <tt>user</tt> and <tt>subject</tt>) or pass onto [[API:EPrints/Apache/REST#serve_dataset|serve_dataset]]. dependent of <tt>@path</tt>. |
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 78: | Line 78: | ||
$rc = EPrints::Apache::REST::serve_dataset( $repository, $dataset, @path ) | $rc = EPrints::Apache::REST::serve_dataset( $repository, $dataset, @path ) | ||
− | Serve listing of data objects for a particular dataset, pass onto | + | Serve listing of data objects for a particular dataset, pass onto [[API:EPrints/Apache/REST#serve_dataobj|serve_dataobj]], [[API:EPrints/Apache/REST#get_dataobj_xml|get_dataobj_xml]] or [[API:EPrints/Apache/REST#put_dataobj_xml|put_dataobj_xml]] or return an appropriate HTTP error code. |
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 91: | Line 91: | ||
$rc = EPrints::Apache::REST::serve_dataobj( $repository, $object, $rights_object, @path ) | $rc = EPrints::Apache::REST::serve_dataobj( $repository, $object, $rights_object, @path ) | ||
− | + | Serve HTML, XML or text version of data object from <tt>GET</tt> or <tt>PUT</tt> request. Pass onto [[API:EPrints/Apache/REST#serve_field|serve_field]] or otherwise return an appropriate HTTP error code. | |
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 104: | Line 104: | ||
$rc = EPrints::Apache::REST::serve_field( $repository, $object, $rights_object, $field, $value, @path ) | $rc = EPrints::Apache::REST::serve_field( $repository, $object, $rights_object, $field, $value, @path ) | ||
− | + | Serve HTML, XML or text version of data object from <tt>GET</tt> requests. Pass on field requests onto [[API:EPrints/Apache/REST#serve_field_single|serve_field_single]] or otherwise return an appropriate HTTP error code. | |
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 117: | Line 117: | ||
$rc = EPrints::Apache::REST::serve_field_single( $repository, $object, $rights_object, $field, $value, @path ) | $rc = EPrints::Apache::REST::serve_field_single( $repository, $object, $rights_object, $field, $value, @path ) | ||
− | + | Serve single field representation by passing onto [[API:EPrints/Apache/REST#serve_subobject|serve_subobject]], [[API:EPrints/Apache/REST#serve_compound|serve_compound]] or <tt>/serve_name</tt> base on type of field. | |
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 130: | Line 130: | ||
$rc = EPrints::Apache::REST::serve_suboject( $repository, $object, $rights_object, $field, $value, @path ) | $rc = EPrints::Apache::REST::serve_suboject( $repository, $object, $rights_object, $field, $value, @path ) | ||
− | Serves sub-object by passing onto | + | Serves sub-object by passing onto [[API:EPrints/Apache/REST#serve_dataobj|serve_dataobj]]. |
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 143: | Line 143: | ||
$rc = EPrints::Apache::REST::serve_compound( $repository, $object, $rights_object, $field, $value, @path ) | $rc = EPrints::Apache::REST::serve_compound( $repository, $object, $rights_object, $field, $value, @path ) | ||
− | Serves compound field by iterating over sub-field, calling | + | Serves compound field by iterating over sub-field, calling [[API:EPrints/Apache/REST#serve_field_single|serve_field_single]] where appropriate. |
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 191: | Line 191: | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
</div> | </div> | ||
− | <!-- Pod2Wiki= | + | <!-- Pod2Wiki=item_send_xml --> |
− | === | + | ===send_xml=== |
− | $rc = EPrints::Apache::REST:: | + | $rc = EPrints::Apache::REST::send_xml( $repository, $xmldata ) |
Sends XML response for REST request. | Sends XML response for REST request. | ||
Line 204: | Line 204: | ||
<!-- Pod2Wiki= --> | <!-- Pod2Wiki= --> | ||
</div> | </div> | ||
− | <!-- Pod2Wiki= | + | <!-- Pod2Wiki=item_send_plaintext --> |
− | === | + | ===send_plaintext=== |
− | $rc = EPrints::Apache::REST:: | + | $rc = EPrints::Apache::REST::send_plaintext( $repository, $content ) |
− | Sends | + | Sends plain text response for REST request. |
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 221: | Line 221: | ||
$allowed = EPrints::Apache::REST::allowed_methods( $repository, @methods ) | $allowed = EPrints::Apache::REST::allowed_methods( $repository, @methods ) | ||
− | Checks if method for | + | Checks if method for request is contained with the <tt>@methods</tt> array of allowed methods. Setting and sending HTTP response headers and code as appropriate. |
Returns boolean depending on whether the request method is allowed. | Returns boolean depending on whether the request method is allowed. | ||
Line 236: | Line 236: | ||
$allowed = EPrints::Apache::REST::allowed_methods( $priv $repository, $rights_object ) | $allowed = EPrints::Apache::REST::allowed_methods( $priv $repository, $rights_object ) | ||
− | Checks is privilege $priv is permitted for the current user and sets HTTP response code as appropriate. | + | Checks is privilege <tt>$priv</tt> is permitted for the current user and sets HTTP response code as appropriate. |
− | Returns boolean depending on whether current user has permitted privilege. | + | Returns boolean depending on whether current user has permitted privilege. |
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 251: | Line 251: | ||
$rc = EPrints::Apache::REST::get_dataobj_xml( $repository, $object, $rights_object ) | $rc = EPrints::Apache::REST::get_dataobj_xml( $repository, $object, $rights_object ) | ||
− | Returns XML | + | Returns XML for REST request to <tt>GET</tt> a data object. |
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 264: | Line 264: | ||
$rc = EPrints::Apache::REST::put_dataobj_xml( $repository, $object, $rights_object ) | $rc = EPrints::Apache::REST::put_dataobj_xml( $repository, $object, $rights_object ) | ||
− | Returns XML | + | Returns XML for REST request to (non-implemented) <tt>PUT</tt> a data object. |
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 277: | Line 277: | ||
$rc = EPrints::Apache::REST::get_field_text( $repository, $object, $rights_object, $field ) | $rc = EPrints::Apache::REST::get_field_text( $repository, $object, $rights_object, $field ) | ||
− | Returns text | + | Returns text for REST request to <tt>GET</tt> a field. |
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 290: | Line 290: | ||
$rc = EPrints::Apache::REST::get_field_xml( $repository, $object, $rights_object, $field ) | $rc = EPrints::Apache::REST::get_field_xml( $repository, $object, $rights_object, $field ) | ||
− | Returns XML for REST request | + | Returns XML for REST request to <tt>GET</tt> a field. |
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 303: | Line 303: | ||
$rc = EPrints::Apache::REST::put_field_xml( $repository, $object, $rights_object, $field ) | $rc = EPrints::Apache::REST::put_field_xml( $repository, $object, $rights_object, $field ) | ||
− | Returns XML for REST request to | + | Returns XML for REST request to <tt>PUT</tt> a field. |
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 316: | Line 316: | ||
$rc = EPrints::Apache::REST::put_field_txt( $repository, $object, $rights_object, $field ) | $rc = EPrints::Apache::REST::put_field_txt( $repository, $object, $rights_object, $field ) | ||
− | Returns text for REST request to | + | Returns text for REST request to <tt>PUT</tt> a field. |
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> |
Latest revision as of 15:48, 15 March 2023
EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects
Latest Source Code (3.4, 3.3) | Revision Log | Before editing this page please read Pod2Wiki
Contents
- 1 NAME
- 2 DESCRIPTION
- 3 METHODS
- 3.1 handler
- 3.2 redir_add_slash
- 3.3 serve_top_level
- 3.4 serve_dataset
- 3.5 serve_dataobj
- 3.6 serve_field
- 3.7 serve_field_single
- 3.8 serve_suboject
- 3.9 serve_compound
- 3.10 serve_compound
- 3.11 render_html
- 3.12 send_html
- 3.13 send_xml
- 3.14 send_plaintext
- 3.15 allowed_methods
- 3.16 allowed_methods
- 3.17 get_dataobj_xml
- 3.18 put_dataobj_xml
- 3.19 get_field_text
- 3.20 get_field_xml
- 3.21 put_field_xml
- 3.22 put_field_txt
- 4 COPYRIGHT
NAME
EPrints::Apache::REST - Representational state transfer
DESCRIPTION
REST API for EPrints
METHODS
handler
$rc = EPrints::Apache::REST::handler( $r )
Handler for EPrints' REST API
redir_add_slash
$rc = EPrints::Apache::REST::redir_add_slash( $repository )
Redirect to the current request for the $repository with an added slash / at the end of the path.
serve_top_level
$rc = EPrints::Apache::REST::serve_top_level( $repository, @path )
Serve top level list of datasets (i.e. eprint, user and subject) or pass onto serve_dataset. dependent of @path.
serve_dataset
$rc = EPrints::Apache::REST::serve_dataset( $repository, $dataset, @path )
Serve listing of data objects for a particular dataset, pass onto serve_dataobj, get_dataobj_xml or put_dataobj_xml or return an appropriate HTTP error code.
serve_dataobj
$rc = EPrints::Apache::REST::serve_dataobj( $repository, $object, $rights_object, @path )
Serve HTML, XML or text version of data object from GET or PUT request. Pass onto serve_field or otherwise return an appropriate HTTP error code.
serve_field
$rc = EPrints::Apache::REST::serve_field( $repository, $object, $rights_object, $field, $value, @path )
Serve HTML, XML or text version of data object from GET requests. Pass on field requests onto serve_field_single or otherwise return an appropriate HTTP error code.
serve_field_single
$rc = EPrints::Apache::REST::serve_field_single( $repository, $object, $rights_object, $field, $value, @path )
Serve single field representation by passing onto serve_subobject, serve_compound or /serve_name base on type of field.
serve_suboject
$rc = EPrints::Apache::REST::serve_suboject( $repository, $object, $rights_object, $field, $value, @path )
Serves sub-object by passing onto serve_dataobj.
serve_compound
$rc = EPrints::Apache::REST::serve_compound( $repository, $object, $rights_object, $field, $value, @path )
Serves compound field by iterating over sub-field, calling serve_field_single where appropriate.
serve_compound
$rc = EPrints::Apache::REST::serve_compound( $repository, $object, $rights_object, $field, $value, @path )
Serves name field.
render_html
$rc = EPrints::Apache::REST::render_html( $html, $title )
Renders HTML for REST request.
send_html
$rc = EPrints::Apache::REST::send_html( $repository, $html, $title )
Sends HTML response for REST request.
send_xml
$rc = EPrints::Apache::REST::send_xml( $repository, $xmldata )
Sends XML response for REST request.
send_plaintext
$rc = EPrints::Apache::REST::send_plaintext( $repository, $content )
Sends plain text response for REST request.
allowed_methods
$allowed = EPrints::Apache::REST::allowed_methods( $repository, @methods )
Checks if method for request is contained with the @methods array of allowed methods. Setting and sending HTTP response headers and code as appropriate.
Returns boolean depending on whether the request method is allowed.
allowed_methods
$allowed = EPrints::Apache::REST::allowed_methods( $priv $repository, $rights_object )
Checks is privilege $priv is permitted for the current user and sets HTTP response code as appropriate.
Returns boolean depending on whether current user has permitted privilege.
get_dataobj_xml
$rc = EPrints::Apache::REST::get_dataobj_xml( $repository, $object, $rights_object )
Returns XML for REST request to GET a data object.
put_dataobj_xml
$rc = EPrints::Apache::REST::put_dataobj_xml( $repository, $object, $rights_object )
Returns XML for REST request to (non-implemented) PUT a data object.
get_field_text
$rc = EPrints::Apache::REST::get_field_text( $repository, $object, $rights_object, $field )
Returns text for REST request to GET a field.
get_field_xml
$rc = EPrints::Apache::REST::get_field_xml( $repository, $object, $rights_object, $field )
Returns XML for REST request to GET a field.
put_field_xml
$rc = EPrints::Apache::REST::put_field_xml( $repository, $object, $rights_object, $field )
Returns XML for REST request to PUT a field.
put_field_txt
$rc = EPrints::Apache::REST::put_field_txt( $repository, $object, $rights_object, $field )
Returns text for REST request to PUT a field.
COPYRIGHT
© Copyright 2000-2024 University of Southampton.
EPrints 3.4 is supplied by EPrints Services.
http://www.eprints.org/eprints-3.4/
LICENSE
This file is part of EPrints 3.4 http://www.eprints.org/.
EPrints 3.4 and this file are released under the terms of the GNU Lesser General Public License version 3 as published by the Free Software Foundation unless otherwise stated.
EPrints 3.4 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with EPrints 3.4. If not, see http://www.gnu.org/licenses/.