Difference between revisions of "API:EPrints/Apache/REST"

From EPrints Documentation
Jump to: navigation, search
 
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 '/' at the end of the path.
+
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::Login::serve_top_level( $repository, @path )
+
  $rc = EPrints::Apache::REST::serve_top_level( $repository, @path )
Serve top level list of datasets (i.e. eprint, user and subject) or pass onto '''EPrints::Apache::Login::serve_datasets'''. dependent of @path.
+
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 '''EPrints::Apache::Login::serve_dataobj''', '''EPrints::Apache::Login::get_dataobj_xml''' or '''EPrints::Apache::Login::put_dataobj_xml''',or return an appropriate HTTP error code.
+
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 )
Servee HTML, XML or text version of data object from GET or PUT request, pass onto '''EPrints::Apache::REST::serve_field''' or otherwise return an appropriate HTTP error code.
+
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 )
Servee HTML, XML or text version of data object from GET requests passsingel field requests onto '''EPrints::Apache::REST::serve_field_single'''  or otherwise return an appropriate HTTP error code.
+
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 )
Servee single field representation by passing onto '''EPrints::Apache::REST::serve_subobject''', '''EPrints::Apache::REST::serve_compound''' or '''EPrints::Apache::REST::serve_name''' base on type of field.
+
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 '''EPrints::Apache::REST::serve_dataobj'''.
+
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  '''EPrints::Apache::REST::serve_field_single''' where appropriate.
+
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=item_send_html -->
+
<!-- Pod2Wiki=item_send_xml -->
===send_html===
+
===send_xml===
  
  $rc = EPrints::Apache::REST::send_html( $repository, $xmldata )
+
  $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=item_send_html -->
+
<!-- Pod2Wiki=item_send_plaintext -->
===send_html===
+
===send_plaintext===
  
  $rc = EPrints::Apache::REST::send_html( $repository, $content )
+
  $rc = EPrints::Apache::REST::send_plaintext( $repository, $content )
Sends plaintext response for REST request.
+
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 eequest is contained with the @methods array of allowed methods.  Setting and sending HTTP response headers and code as appropriate.
+
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 ot REST request to get a data object.
+
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 to REST request to (non-implemented) put data object.
+
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 to to REST request to get field.
+
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 for a field.
+
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 put a field.
+
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 put a field.
+
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


API: Core API

Latest Source Code (3.4, 3.3) | Revision Log | Before editing this page please read Pod2Wiki


NAME

EPrints::Apache::REST - Representational state transfer

User Comments


DESCRIPTION

REST API for EPrints

User Comments


METHODS

User Comments


handler

$rc = EPrints::Apache::REST::handler( $r )

Handler for EPrints' REST API

User Comments


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.

User Comments


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.

User Comments


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.

User Comments


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.

User Comments


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.

User Comments


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.

User Comments


serve_suboject

$rc = EPrints::Apache::REST::serve_suboject( $repository, $object, $rights_object, $field, $value, @path )

Serves sub-object by passing onto serve_dataobj.

User Comments


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.

User Comments


serve_compound

$rc = EPrints::Apache::REST::serve_compound( $repository, $object, $rights_object, $field, $value, @path )

Serves name field.

User Comments


render_html

$rc = EPrints::Apache::REST::render_html( $html, $title )

Renders HTML for REST request.

User Comments


send_html

$rc = EPrints::Apache::REST::send_html( $repository, $html, $title )

Sends HTML response for REST request.

User Comments


send_xml

$rc = EPrints::Apache::REST::send_xml( $repository, $xmldata )

Sends XML response for REST request.

User Comments


send_plaintext

$rc = EPrints::Apache::REST::send_plaintext( $repository, $content )

Sends plain text response for REST request.

User Comments


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.

User Comments


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.

User Comments


get_dataobj_xml

$rc = EPrints::Apache::REST::get_dataobj_xml( $repository, $object, $rights_object )

Returns XML for REST request to GET a data object.

User Comments


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.

User Comments


get_field_text

$rc = EPrints::Apache::REST::get_field_text( $repository, $object, $rights_object, $field )

Returns text for REST request to GET a field.

User Comments


get_field_xml

$rc = EPrints::Apache::REST::get_field_xml( $repository, $object, $rights_object, $field )

Returns XML for REST request to GET a field.

User Comments


put_field_xml

$rc = EPrints::Apache::REST::put_field_xml( $repository, $object, $rights_object, $field )

Returns XML for REST request to PUT a field.

User Comments


put_field_txt

$rc = EPrints::Apache::REST::put_field_txt( $repository, $object, $rights_object, $field )

Returns text for REST request to PUT a field.

User Comments


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/.

User Comments