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

From EPrints Documentation
Jump to: navigation, search
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
<!-- Pod2Wiki=_preamble_  
 
<!-- Pod2Wiki=_preamble_  
This page has been automatically generated from the EPrints 3.2 source. Any wiki changes made between the 'Pod2Wiki=*' and 'Edit below this comment' comments will be lost.
+
This page has been automatically generated from the EPrints 3.4 source. Any wiki changes made between the 'Pod2Wiki=*' and 'Edit below this comment' comments will be lost.
  -->{{API}}{{Pod2Wiki}}{{API:Source|file=perl_lib/EPrints/Apache/CRUD.pm|package_name=EPrints::Apache::CRUD}}[[Category:API|CRUD]][[Category:API:EPrints/Apache|CRUD]][[Category:API:EPrints/Apache/CRUD|CRUD]]<div><!-- Edit below this comment -->
+
  -->{{API}}{{Pod2Wiki}}{{API:Source|file=EPrints/Apache/CRUD.pm|package_name=EPrints::Apache::CRUD}}[[Category:API|CRUD]][[Category:API:EPrints/Apache|CRUD]]<div><!-- Edit below this comment -->
  
  
<!-- Pod2Wiki=_private_ -->{{Version|since=3.3.0}}
+
<!-- Pod2Wiki=_private_ -->{{Version|since=3.3.0}}<!-- Pod2Wiki=head_name -->
 
 
<!-- Pod2Wiki=head_name -->
 
 
==NAME==
 
==NAME==
EPrints::Apache::CRUD - Create, read, update and delete via HTTP
+
'''EPrints::Apache::CRUD''' - Create, read, update and delete via HTTP
  
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
 +
</div>
 
<!-- Pod2Wiki=head_synopsis -->
 
<!-- Pod2Wiki=head_synopsis -->
 
==SYNOPSIS==
 
==SYNOPSIS==
<source lang="perl">$crud = EPrints::Apache::CRUD->new(
+
  $crud = EPrints::Apache::CRUD-&gt;new(
repository => $repo,
+
      repository =&gt; $repo,
request => $r,
+
      request =&gt; $r,
datasetid => "eprint",
+
      datasetid =&gt; "eprint",
dataobjid => "23",
+
      dataobjid =&gt; "23",
);</source>
+
    );
 
+
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
 +
</div>
 
<!-- Pod2Wiki=head_description -->
 
<!-- Pod2Wiki=head_description -->
 
==DESCRIPTION==
 
==DESCRIPTION==
Line 33: Line 37:
 
You should use the &lt;link&gt; entries in the repository's home page to locate the CRUD endpoint, as they may change in the future:
 
You should use the &lt;link&gt; entries in the repository's home page to locate the CRUD endpoint, as they may change in the future:
  
<pre>  &lt;link rel="Sword" href="https://myrepo/sword-app/servicedocument" /&gt;
+
  &lt;link rel="Sword" href="https://myrepo/sword-app/servicedocument" /&gt;
   &lt;link rel="SwordDeposit" href="https://myrepo/id/contents" /&gt;</pre>
+
   &lt;link rel="SwordDeposit" href="https://myrepo/id/contents" /&gt;
 
+
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
 +
</div>
 
<!-- Pod2Wiki=head_examples -->
 
<!-- Pod2Wiki=head_examples -->
 
===Examples===
 
===Examples===
 
Create a new eprint based on a single file:
 
Create a new eprint based on a single file:
  
<pre>  curl -X POST \
+
  curl -X POST \
 
     -i \
 
     -i \
 
     -u user:password \
 
     -u user:password \
Line 53: Line 60:
 
   HTTP/1.1 201 Created
 
   HTTP/1.1 201 Created
 
   Content-Type: application/atom+xml;charset=utf-8
 
   Content-Type: application/atom+xml;charset=utf-8
   ...</pre>
+
   ...
 
+
 
 
Add a file to an existing eprint:
 
Add a file to an existing eprint:
  
<pre>  curl -X POST \
+
  curl -X POST \
 
     -i \
 
     -i \
 
     -u user:password \
 
     -u user:password \
Line 67: Line 74:
 
   HTTP/1.1 201 Created
 
   HTTP/1.1 201 Created
 
   Content-Type: application/atom+xml;charset=utf-8
 
   Content-Type: application/atom+xml;charset=utf-8
   ...</pre>
+
   ...
 
+
 
 
Get an eprint's metadata in Atom XML:
 
Get an eprint's metadata in Atom XML:
  
<pre>  curl -X GET \
+
  curl -X GET \
 
     -i \
 
     -i \
 
     -u user:password \
 
     -u user:password \
Line 79: Line 86:
 
   HTTP/1.1 200 OK
 
   HTTP/1.1 200 OK
 
   Content-Type: application/atom+xml;charset=utf-8
 
   Content-Type: application/atom+xml;charset=utf-8
   ...</pre>
+
   ...
 
+
 
 
Get the list of contents (documents) of an eprint in Atom XML:
 
Get the list of contents (documents) of an eprint in Atom XML:
  
<pre>  curl -X GET \
+
  curl -X GET \
 
     -i \
 
     -i \
 
     -u user:password \
 
     -u user:password \
Line 91: Line 98:
 
   HTTP/1.1 200 OK
 
   HTTP/1.1 200 OK
 
   Content-Type: application/atom+xml;charset=utf-8
 
   Content-Type: application/atom+xml;charset=utf-8
   ...</pre>
+
   ...
 
+
 
 
You can find more examples in the ''tests/84_sword.t'' unit test.
 
You can find more examples in the ''tests/84_sword.t'' unit test.
  
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
 +
</div>
 
<!-- Pod2Wiki=head_uri_layout -->
 
<!-- Pod2Wiki=head_uri_layout -->
 
===URI layout===
 
===URI layout===
 
These URIs are relative to your EPrints HTTP/HTTPs root.
 
These URIs are relative to your EPrints HTTP/HTTPs root.
  
* /id/contents GET,HEAD,OPTIONS,POST
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
: Requires authentication.
+
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
  
: GET a list of the eprints owned by the user. POST to create a new EPrint object.
 
  
* /id/[datasetid]/[dataobjid] DELETE,GET,HEAD,OPTIONS,PUT
+
<!-- Pod2Wiki= -->
: Requires authentication depending on user's privileges and object visibility.
+
</div>
 +
<!-- Pod2Wiki=item_id_contents_get_head_options_post -->
 +
====/id/contents GET,HEAD,OPTIONS,POST====
 +
 
 +
Requires authentication.
  
: GET an object's metadata or, for [[API:EPrints/DataObj/File|File]] objects, the file content. PUT to replace the metadata and/or contents (see [[API:EPrints/Apache/CRUD#Updating_complex_objects_using_PUT|Updating complex objects using PUT]]). If the object does not exist will attempt to create it with the given dataobjid (requires 'upsert' privilege).
+
GET a list of the eprints owned by the user. POST to create a new EPrint object.
  
* /id/[datasetid]/[dataobjid]/contents DELETE,GET,HEAD,OPTIONS,POST,PUT
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
: Requires authentication depending on user's privileges and object visibility.
+
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
  
: GET the logical contents of the object: documents for eprints or files for documents. PUT to replace the existing contents or POST to add to the existing contents.
 
  
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_id_datasetid_dataobjid_delete_get_head_options_put -->
 +
====/id/[datasetid]/[dataobjid] DELETE,GET,HEAD,OPTIONS,PUT====
 +
 +
Requires authentication depending on user's privileges and object visibility.
 +
 +
GET an object's metadata or, for {{API:PodLink|file=EPrints/DataObj/File|package_name=EPrints::DataObj::File|section=|text=File}} objects, the file content. PUT to replace the metadata and/or contents (see [[API:EPrints/Apache/CRUD#Updating_complex_objects_using_PUT|Updating complex objects using PUT]]). If the object does not exist will attempt to create it with the given dataobjid (requires 'upsert' privilege).
 +
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_id_datasetid_dataobjid_contents_delete_get_head_options_post_put -->
 +
====/id/[datasetid]/[dataobjid]/contents DELETE,GET,HEAD,OPTIONS,POST,PUT====
 +
 +
Requires authentication depending on user's privileges and object visibility.
 +
 +
GET the logical contents of the object: documents for eprints or files for documents. PUT to replace the existing contents or POST to add to the existing contents.
 +
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 +
 +
<!-- Pod2Wiki= -->
 +
</div>
 
<!-- Pod2Wiki=head_http_content_negotiation -->
 
<!-- Pod2Wiki=head_http_content_negotiation -->
 
===HTTP Content Negotiation===
 
===HTTP Content Negotiation===
GET/HEAD requests are processed using [[API:EPrints/Plugin/Export|Export]] plugins. POST/PUT requests are processed using [[API:EPrints/Plugin/Import|Import]] plugins.
+
GET/HEAD requests are processed using {{API:PodLink|file=EPrints/Plugin/Export|package_name=EPrints::Plugin::Export|section=|text=Export}} plugins. POST/PUT requests are processed using {{API:PodLink|file=EPrints/Plugin/Import|package_name=EPrints::Plugin::Import|section=|text=Import}} plugins.
  
 
The plugin used depends on the request's <em>Accept</em> (GET/HEAD) or <em>Content-Type</em> (POST/PUT) header and the type of object being acted on. For example, the following request:
 
The plugin used depends on the request's <em>Accept</em> (GET/HEAD) or <em>Content-Type</em> (POST/PUT) header and the type of object being acted on. For example, the following request:
  
<pre>  GET /id/eprint/23 HTTP/1.1
+
  GET /id/eprint/23 HTTP/1.1
   Accept: application/vnd.eprints.data+xml</pre>
+
   Accept: application/vnd.eprints.data+xml
 +
 
 +
Will search for an Export plugin that accepts objects of type '''dataobj/eprint''' and can produce output in the MIME type '''application/vnd.eprints.data+xml'''. This will most likely be the {{API:PodLink|file=EPrints/Plugin/Export/XML|package_name=EPrints::Plugin::Export::XML|section=|text=EP3 XML}} plugin.
 +
 
 +
In addition to the general plugin negotiation behaviour some special cases are supported to improve compatibility with Atom Pub/Web Browser clients:
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_id_eprint -->
 +
====/id/eprint/...====
 +
 
 +
Requesting {{API:PodLink|file=EPrints/DataObj/EPrint|package_name=EPrints::DataObj::EPrint|section=|text=EPrint}} objects as text/html will result in a 303 Redirect to the eprint object's abstract page or, if the eprint is not public, its {{API:PodLink|file=EPrints/Plugin/Screen/EPrint/View|package_name=EPrints::Plugin::Screen::EPrint::View|section=|text=View}} page.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_id_document_contents -->
 +
====/id/document/.../contents====
 +
 
 +
Requesting the <em>/contents</em> of a {{API:PodLink|file=EPrints/DataObj/Document|package_name=EPrints::DataObj::Document|section=|text=Document}} object will return the content of the document's main file.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
  
Will search for an Export plugin that accepts objects of type '''dataobj/eprint''' and can produce output in the MIME type '''application/vnd.eprints.data+xml'''. This will most likely be the [[API:EPrints/Plugin/Export/XML|EP3 XML]] plugin.
 
  
In addition to the general plugin negotiation behaviour some special cases are supported to improve compatibility with Atom Pub/Web Browser clients:
+
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_id_file -->
 +
====/id/file/...====
 +
 
 +
Requesting a {{API:PodLink|file=EPrints/DataObj/File|package_name=EPrints::DataObj::File|section=|text=File}} object with no <em>Accept</em> header (or '''*/*''') will return the file's content.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_post_id_contents -->
 +
====POST /id/.../contents====
 +
 
 +
When creating new records via POST, content negotiation is performed against the Import plugins.
  
* /id/eprint/...
+
If no Import plugin supports the <em>Content-Type</em> header the content will be treated as '''application/octet-stream''' and stored in a new object. The resulting Atom entry will describe the new object (e.g. the <em>eprint</em> object in which the new <em>document</em> and <em>file</em> objects were created).
: Requesting [[API:EPrints/DataObj/EPrint|EPrint]] objects as text/html will result in a 303 Redirect to the eprint object's abstract page or, if the eprint is not public, its [[API:EPrints/Plugin/Screen/EPrint/View|View]] page.
 
  
* /id/document/.../contents
+
Otherwise, the result will depend on the Import plugin's output. Import plugins may produce a single object, multiple objects or an object plus content file(s).
: Requesting the <em>/contents</em> of a [[API:EPrints/DataObj/Document|Document]] object will return the content of the document's main file.
 
  
* /id/file/...
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
: Requesting a [[API:EPrints/DataObj/File|File]] object with no <em>Accept</em> header (or '''*/*''') will return the file's content.
+
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
  
* POST /id/.../contents
 
: When creating new records via POST, content negotiation is performed against the Import plugins.
 
  
: If no Import plugin supports the <em>Content-Type</em> header the content will be treated as '''application/octet-stream''' and stored in a new object. The resulting Atom entry will describe the new object (e.g. the <em>eprint</em> object in which the new <em>document</em> and <em>file</em> objects were created).
+
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_content_type_header -->
 +
====Content-Type header====
  
: Otherwise, the result will depend on the Import plugin's output. Import plugins may produce a single object, multiple objects or an object plus content file(s).
+
If no <em>Content-Type</em> header is given the MIME type defaults to '''application/octet-stream''' for POSTs and PUTs.
  
* Content-Type header
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
: If no <em>Content-Type</em> header is given the MIME type defaults to '''application/octet-stream''' for POSTs and PUTs.
+
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
  
* Content-Disposition header
 
: If the <em>Content-Disposition</em> header is missing or does not contain a <em>filename</em> parameter the filename defaults to ''main.bin'' for POSTs and PUTs.
 
  
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_content_disposition_header -->
 +
====Content-Disposition header====
 +
 +
If the <em>Content-Disposition</em> header is missing or does not contain a <em>filename</em> parameter the filename defaults to ''main.bin'' for POSTs and PUTs.
 +
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
 +
</div>
 
<!-- Pod2Wiki=head_updating_complex_objects_using_put -->
 
<!-- Pod2Wiki=head_updating_complex_objects_using_put -->
 
===Updating complex objects using PUT===
 
===Updating complex objects using PUT===
Eprint objects contain zero or more documents, which each contain zero or more files. When you update (PUT) an eprint object the contained documents will only be replaced if the Import plugin defines new documents e.g. the Atom Import plugin will never define new documents so PUTing Atom content will only update the eprint's metadata. PUTing [[API:EPrints/Plugin/Export/XML|EP3 XML]] will replace the documents if you include a &lt;documents&gt; XML element.
+
Eprint objects contain zero or more documents, which each contain zero or more files. When you update (PUT) an eprint object the contained documents will only be replaced if the Import plugin defines new documents e.g. the Atom Import plugin will never define new documents so PUTing Atom content will only update the eprint's metadata. PUTing {{API:PodLink|file=EPrints/Plugin/Export/XML|package_name=EPrints::Plugin::Export::XML|section=|text=EP3 XML}} will replace the documents if you include a &lt;documents&gt; XML element.
  
 
PUTing to <em>/contents</em> will always replace all contents - PUTing to <em>/eprint/23/contents</em> is equivalent to <em>DELETE /eprint/23/contents</em> then <em>POST /eprint/23/contents</em>.
 
PUTing to <em>/contents</em> will always replace all contents - PUTing to <em>/eprint/23/contents</em> is equivalent to <em>DELETE /eprint/23/contents</em> then <em>POST /eprint/23/contents</em>.
  
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
 +
</div>
 
<!-- Pod2Wiki=head_put_delete_from_javascript -->
 
<!-- Pod2Wiki=head_put_delete_from_javascript -->
 
===PUT/DELETE from Javascript===
 
===PUT/DELETE from Javascript===
<!-- Pod2Wiki=_private_ -->{{Available|since=3.3.9}}
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
+
<span style='display:none'>User Comments</span>
Web browsers only allow GET and POST requests. To perform other requests use the 'X-Method' header with POST to specify the actual method you want:
 
 
 
<pre> POST /id/eprint/23 HTTP/1.1
 
  X-Method: PUT
 
  ...</pre>
 
 
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
 +
</div>
 
<!-- Pod2Wiki=head_upserting_objects_with_put -->
 
<!-- Pod2Wiki=head_upserting_objects_with_put -->
 
===Upserting objects with PUT===
 
===Upserting objects with PUT===
<!-- Pod2Wiki=_private_ -->{{Available|since=3.3.9}}
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
  
If you have the <em>upsert</em> privilege objects will be created on demand, otherwise attempting to PUT to a non-existant object will result in an error.
 
  
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=head_methods -->
 +
==METHODS==
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=head_methods -->
+
</div>
==METHODS==
+
<!-- Pod2Wiki=item_repository -->
<!-- Pod2Wiki=head_repository -->
 
 
===repository===
 
===repository===
  
<source lang="perl">$repo = $crud->repository()
+
$repo = $crud-&gt;repository()
 
 
</source>
 
 
Returns the current repository.
 
Returns the current repository.
  
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=head_request -->
+
</div>
 +
<!-- Pod2Wiki=item_request -->
 
===request===
 
===request===
  
<source lang="perl">$r = $crud->request()
+
$r = $crud-&gt;request()
 
 
</source>
 
 
Returns the current {{API:PodLink|file=Apache2/RequestUtil|package_name=Apache2::RequestUtil|section=|text=Apache2::RequestUtil}}.
 
Returns the current {{API:PodLink|file=Apache2/RequestUtil|package_name=Apache2::RequestUtil|section=|text=Apache2::RequestUtil}}.
  
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=head_method -->
+
</div>
 +
<!-- Pod2Wiki=item_method -->
 
===method===
 
===method===
  
<source lang="perl">$method = $crud->method()
+
$method = $crud-&gt;method()
 
 
</source>
 
 
Returns the HTTP method.
 
Returns the HTTP method.
  
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=head_scope -->
+
</div>
 +
<!-- Pod2Wiki=item_scope -->
 
===scope===
 
===scope===
  
<source lang="perl">$scope = $crud->scope()
+
$scope = $crud-&gt;scope()
 
 
</source>
 
 
Returns the scope of the action being performed.
 
Returns the scope of the action being performed.
  
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=head_dataset -->
+
</div>
 +
<!-- Pod2Wiki=item_dataset -->
 
===dataset===
 
===dataset===
  
<source lang="perl">$dataset = $crud->dataset()
+
$dataset = $crud-&gt;dataset()
 
 
</source>
 
 
Returns the current dataset (if any).
 
Returns the current dataset (if any).
  
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=head_dataobj -->
+
</div>
 +
<!-- Pod2Wiki=item_dataobj -->
 
===dataobj===
 
===dataobj===
  
<source lang="perl">$dataobj = $crud->dataobj()
+
$dataobj = $crud-&gt;dataobj()
 
 
</source>
 
 
Returns the current dataobj (if any).
 
Returns the current dataobj (if any).
  
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=head_field -->
+
</div>
 +
<!-- Pod2Wiki=item_field -->
 
===field===
 
===field===
  
<source lang="perl">$field = $crud->field()
+
$field = $crud-&gt;field()
 
 
</source>
 
 
Returns the current field (if available);
 
Returns the current field (if available);
  
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=head_headers -->
+
</div>
 +
<!-- Pod2Wiki=item_headers -->
 
===headers===
 
===headers===
  
<source lang="perl">$headers = $crud->headers()
+
$headers = $crud-&gt;headers()
 
 
</source>
 
 
Get the processed headers.
 
Get the processed headers.
  
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=head_options -->
+
</div>
 +
<!-- Pod2Wiki=item_options -->
 
===options===
 
===options===
  
<source lang="perl">@verbs = $crud->options()
+
@verbs = $crud-&gt;options()
 
 
</source>
 
 
Returns the available HTTP verbs for the current request.
 
Returns the available HTTP verbs for the current request.
  
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=head_plugin -->
+
</div>
 +
<!-- Pod2Wiki=item_plugin -->
 
===plugin===
 
===plugin===
  
<source lang="perl">$plugin = $crud->plugin()
+
$plugin = $crud-&gt;plugin()
 
 
</source>
 
 
Returns the current plugin (if available).
 
Returns the current plugin (if available).
  
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=head_is_write -->
+
</div>
 +
<!-- Pod2Wiki=item_is_write -->
 
===is_write===
 
===is_write===
  
<source lang="perl">$bool = $crud->is_write()
+
$bool = $crud-&gt;is_write()
 
 
</source>
 
 
Returns true if the request is not a read-only method.
 
Returns true if the request is not a read-only method.
  
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=head_accept_type -->
+
</div>
 +
<!-- Pod2Wiki=item_accept_type -->
 
===accept_type===
 
===accept_type===
  
<source lang="perl">$accept_type = $crud->accept_type()
+
$accept_type = $crud-&gt;accept_type()
 
 
</source>
 
 
Returns the EPrints type for the current request.
 
Returns the EPrints type for the current request.
  
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=head_check_packaging -->
+
</div>
 +
<!-- Pod2Wiki=item_check_packaging -->
 
===check_packaging===
 
===check_packaging===
  
<source lang="perl">$rc = $crud->check_packaging()
+
$rc = $crud-&gt;check_packaging()
 
 
</source>
 
 
Check the Packaging header is ok, if given.
 
Check the Packaging header is ok, if given.
  
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=head_resolve_relations -->
+
</div>
 +
<!-- Pod2Wiki=item_resolve_relations -->
 
===resolve_relations===
 
===resolve_relations===
  
<source lang="perl">$dataobj = $crud->resolve_relations( $dataobj [, @relations ] )
+
$dataobj = $crud-&gt;resolve_relations( $dataobj [, @relations ] )
 
 
</source>
 
 
Resolve the relation path from $dataobj and return the resulting dataobj.
 
Resolve the relation path from $dataobj and return the resulting dataobj.
  
 
Returns undef if there is no such related object.
 
Returns undef if there is no such related object.
  
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=head_parse_input -->
+
</div>
 +
<!-- Pod2Wiki=item_authen -->
 +
===authen===
 +
 
 +
$rc = $crud-&gt;authen
 +
Returns HTTP code based of whether CRUD request can be authenticated.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_authz -->
 +
===authz===
 +
 
 +
$rc = $crud-&gt;authz
 +
Returns HTTP code based of whether CRUD request can be authorized.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_parse_input -->
 
===parse_input===
 
===parse_input===
  
<source lang="perl">$list = $crud->parse_input( $plugin, $f [, %params ] )
+
$list = $crud-&gt;parse_input( $plugin, $f [, %params ] )
 
 
</source>
 
 
Parse the content submitted by the user using the given $plugin.  $f is called by epdata_to_dataobj to convert epdata to a dataobj.  %params are passed to the plugin's input_fh method.
 
Parse the content submitted by the user using the given $plugin.  $f is called by epdata_to_dataobj to convert epdata to a dataobj.  %params are passed to the plugin's input_fh method.
  
 
Returns undef on error.
 
Returns undef on error.
  
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=head_import_plugins -->
+
</div>
 +
<!-- Pod2Wiki=item_create_dataobj -->
 +
===create_dataobj===
 +
 
 +
$dataobj = $crud-&gt;create_dataobj( $owner, $epdata )
 +
Creates data object as user $owner with metadata from $epdata
 +
 
 +
Returns an [[API:EPrints/DataObj|EPrints::DataObj]]
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_import_plugins -->
 
===import_plugins===
 
===import_plugins===
  
<source lang="perl">@plugins = $crud->import_plugins( [ %params ] )
+
@plugins = $crud-&gt;import_plugins( [ %params ] )
 
 
</source>
 
 
Returns all matching import plugins against %params ordered by descending 'q' score.
 
Returns all matching import plugins against %params ordered by descending 'q' score.
  
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=head_export_plugins -->
+
</div>
 +
<!-- Pod2Wiki=item_export_plugins -->
 
===export_plugins===
 
===export_plugins===
  
<source lang="perl">@plugins = $crud->export_plugins( [ %params ] )
+
@plugins = $crud-&gt;export_plugins( [ %params ] )
 
 
</source>
 
 
Returns all matching export plugins against %params ordered by descending 'q' score.
 
Returns all matching export plugins against %params ordered by descending 'q' score.
  
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=head_content_negotiate_best_plugin -->
+
</div>
 +
<!-- Pod2Wiki=item_content_negotiate_best_plugin -->
 
===content_negotiate_best_plugin===
 
===content_negotiate_best_plugin===
  
<source lang="perl">$plugin = $crud->content_negotiate_best_plugin()
+
$plugin = $crud-&gt;content_negotiate_best_plugin()
 +
Work out the best plugin to export/update an object based on the client-headers.
  
</source>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
Work out the best plugin to export/update an object based on the client-headers.
+
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_crud -->
 +
===crud===
 +
 
 +
EPrints::Apache::CRUD( $media_range )
 +
Takes the $media_range string and returns array of acceptable MIME types. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1 for more detail.
  
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=head_DELETE -->
+
</div>
===DELETE===
+
<!-- Pod2Wiki=item_handler -->
 +
===handler===
 +
 
 +
$rc = $crud-&gt;handler
 +
Handler of CRUD requests.
  
<source lang="perl">$rc = $crud->DELETE()
+
Returns HTTP response code.
  
</source>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_delete -->
 +
===delete===
 +
 
 +
$rc = $crud-&gt;DELETE()
 
Handle DELETE requests.
 
Handle DELETE requests.
  
* HTTP_METHOD_NOT_ALLOWED
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
: Can't perform DELETE on ''/id/contents''.
+
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_http_method_not_allowed -->
 +
===http_method_not_allowed===
 +
 
 +
HTTP_METHOD_NOT_ALLOWED
 +
Can't perform DELETE on ''/id/contents''.
  
* HTTP_NOT_FOUND
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
: No such object.
+
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
  
* HTTP_CONFLICT
 
: Lock conflict with another user.
 
  
* HTTP_NO_CONTENT
+
<!-- Pod2Wiki= -->
: Successfully removed the object.
+
</div>
 +
<!-- Pod2Wiki=item_http_not_found -->
 +
===http_not_found===
  
 +
HTTP_NOT_FOUND
 +
No such object.
 +
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=head_GET -->
+
</div>
===GET===
+
<!-- Pod2Wiki=item_http_conflict -->
 +
===http_conflict===
  
<source lang="perl">$rc = $crud->GET( [ $owner ] )
+
HTTP_CONFLICT
 +
Lock conflict with another user.
  
</source>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_http_no_content -->
 +
===http_no_content===
 +
 
 +
HTTP_NO_CONTENT
 +
Successfully removed the object.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_get -->
 +
===get===
 +
 
 +
$rc = $crud-&gt;GET( [ $owner ] )
 
Handle GET requests.
 
Handle GET requests.
  
* HTTP_NO_CONTENT
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
: No sub-objects in <em>/id/.../contents</em>.
+
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_http_no_content -->
 +
===http_no_content===
 +
 
 +
HTTP_NO_CONTENT
 +
No sub-objects in <em>/id/.../contents</em>.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_http_not_acceptable -->
 +
===http_not_acceptable===
 +
 
 +
HTTP_NOT_ACCEPTABLE
 +
More than one sub-object in <em>/id/.../contents</em>.
  
* HTTP_NOT_ACCEPTABLE
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
: More than one sub-object in <em>/id/.../contents</em>.
+
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
  
* HTTP_UNSUPPORTED_MEDIA_TYPE
 
: No [[API:EPrints/Plugin/Export|Export]] plugin matches the <em>Accept</em> header/object type.
 
  
* HTTP_SEE_OTHER
+
<!-- Pod2Wiki= -->
: Redirect to a non-CRUD EPrints page.
+
</div>
 +
<!-- Pod2Wiki=item_http_unsupported_media_type -->
 +
===http_unsupported_media_type===
  
* HTTP_NOT_FOUND
+
HTTP_UNSUPPORTED_MEDIA_TYPE
: Object not found.
+
No {{API:PodLink|file=EPrints/Plugin/Export|package_name=EPrints::Plugin::Export|section=|text=Export}} plugin matches the <em>Accept</em> header/object type.
  
* HTTP_OK
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
: Object outputted successfully.
+
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
  
 +
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_http_see_other -->
 +
===http_see_other===
 +
 +
HTTP_SEE_OTHER
 +
Redirect to a non-CRUD EPrints page.
 +
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=head_POST -->
+
</div>
===POST===
+
<!-- Pod2Wiki=item_http_not_found -->
 +
===http_not_found===
 +
 
 +
HTTP_NOT_FOUND
 +
Object not found.
  
<source lang="perl">$rc = $crud->POST( [ $owner ] )
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
  
</source>
+
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_http_ok -->
 +
===http_ok===
 +
 
 +
HTTP_OK
 +
Object outputted successfully.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_post -->
 +
===post===
 +
 
 +
$rc = $crud-&gt;POST( [ $owner ] )
 
Handle POST requests.
 
Handle POST requests.
  
* HTTP_METHOD_NOT_ALLOWED
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
: Can only POST to <em>/id/.../contents</em>.
+
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_http_method_not_allowed -->
 +
===http_method_not_allowed===
 +
 
 +
HTTP_METHOD_NOT_ALLOWED
 +
Can only POST to <em>/id/.../contents</em>.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
  
* HTTP_BAD_REQUEST
+
<!-- Pod2Wiki= -->
: No plugin for the SWORD <em>Packaging</em> header.
+
</div>
 +
<!-- Pod2Wiki=item_http_bad_request -->
 +
===http_bad_request===
  
* HTTP_CREATED
+
HTTP_BAD_REQUEST
: Object(s) successfully created.
+
No plugin for the SWORD <em>Packaging</em> header.
  
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=head_PUT -->
+
</div>
===PUT===
+
<!-- Pod2Wiki=item_http_created -->
 +
===http_created===
  
<source lang="perl">$rc = $crud->PUT( [ $owner ] )
+
HTTP_CREATED
 +
Object(s) successfully created.
  
</source>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_put -->
 +
===put===
 +
 
 +
$rc = $crud-&gt;PUT( [ $owner ] )
 
Handle PUT requests.
 
Handle PUT requests.
  
* HTTP_UNSUPPORTED_MEDIA_TYPE
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
: No [[API:EPrints/Plugin/Import|Import]] plugin matched the <em>Content-Type</em> header/object type.
+
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_http_unsupported_media_type -->
 +
===http_unsupported_media_type===
  
* HTTP_RANGE_NOT_SATISFIABLE
+
HTTP_UNSUPPORTED_MEDIA_TYPE
: <em>Range</em> header is invalid or unsupported for the <em>object type</em>.
+
No {{API:PodLink|file=EPrints/Plugin/Import|package_name=EPrints::Plugin::Import|section=|text=Import}} plugin matched the <em>Content-Type</em> header/object type.
  
* HTTP_FORBIDDEN
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
: User does not have permission to create/update the <em>object</em>.
+
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
  
* HTTP_CREATED
 
: Object was successfully created.
 
  
* HTTP_NO_CONTENT
+
<!-- Pod2Wiki= -->
: Object was successfully updated.
+
</div>
 +
<!-- Pod2Wiki=item_http_range_not_satisfiable -->
 +
===http_range_not_satisfiable===
  
 +
HTTP_RANGE_NOT_SATISFIABLE
 +
<em>Range</em> header is invalid or unsupported for the <em>object type</em>.
 +
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=head_PUT_contents -->
+
</div>
===PUT_contents===
+
<!-- Pod2Wiki=item_http_forbidden -->
 +
===http_forbidden===
  
<source lang="perl">$rc = $crud->PUT_contents( [ $owner ] )
+
HTTP_FORBIDDEN
 +
User does not have permission to create/update the <em>object</em>.
  
</source>
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
Equivalent to <code>DELETE /id/.../contents</code> then <code>POST /id/.../contents</code>.
+
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_http_created -->
 +
===http_created===
 +
 
 +
HTTP_CREATED
 +
Object was successfully created.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_http_no_content -->
 +
===http_no_content===
 +
 
 +
HTTP_NO_CONTENT
 +
Object was successfully updated.
 +
 
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_put_contents -->
 +
===put_contents===
 +
 
 +
$rc = $crud-&gt;PUT_contents( [ $owner ] )
 +
Equivalent to <tt>DELETE /id/.../contents</tt> then <tt>POST /id/.../contents</tt>.
  
 
See [[API:EPrints/Apache/CRUD#DELETE|DELETE]] and [[API:EPrints/Apache/CRUD#POST|POST]].
 
See [[API:EPrints/Apache/CRUD#DELETE|DELETE]] and [[API:EPrints/Apache/CRUD#POST|POST]].
  
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_metadata_relevant -->
 +
===metadata_relevant===
 +
 +
$crud-&gt;metadata_relevant( $file )
 +
Test and if suitable use $file as metadata source to updatie the associated [[API:EPrints/DataObj/EPrint|EPrints::DataObj::EPrint]].
 +
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 +
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_servicedocument -->
 +
===servicedocument===
 +
 +
$crud-&gt;servicedocument
 +
Gennerate response containing CRUD service document.
 +
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 +
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_on_behalf_of -->
 +
===on_behalf_of===
 +
 +
$rc = $crud-&gt;on_behalf_of( $user )
 +
Submit CRUD request on behalf od another user.
 +
 +
Returns HTTPS response code based on wehther request on behalf of is  permitted.
 +
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 +
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_is_true -->
 +
===is_true===
 +
 +
$boolean = EPrints::Apache::Crud::is_true( $header )
 +
Tests if $header attribute is true.
 +
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 +
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_is_false -->
 +
===is_false===
 +
 +
$boolean = EPrints::Apache::Crud::is_false( $header )
 +
Tests if $header attribute is false.
 +
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 +
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_is_file_ok -->
 +
===is_file_ok===
 +
 +
$boolean = $crud-&gt;is_file_ok( $epdata )
 +
Tests if files with $epdata were uploaded with corruption.
 +
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 +
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_process_headers -->
 +
===process_headers===
 +
 +
$boolean = $crud-&gt;process_headers
 +
Process headers of CRUD request
 +
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 +
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_$boolean -->
 +
===$boolean===
 +
 +
$boolean = $crud-&gt;( %opts )
 +
Generate SWORD error documents based on provided %opts.
 +
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 +
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_plugin_error -->
 +
===plugin_error===
 +
 +
$boolean = $crud-&gt;plugin_error( $plugin, $messages )
 +
Generate error message for import $plugin used with $messages provided.
 +
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 +
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_generate_error_document -->
 +
===generate_error_document===
 +
 +
$error_document = EPrints::Apache::Crud::generate_error_document( $repo, %opts )
 +
Return error document for [[API:EPrints/Repository|EPrints::Repository]] $repo using options  from %opts.
 +
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 +
 +
<!-- Pod2Wiki= -->
 +
</div>
 +
<!-- Pod2Wiki=item_send_response -->
 +
===send_response===
 +
 +
$rc = $crud-&gt;send_response( $status, $content_type, $content )
 +
Output response to CRUD request with HTTP status code $status, content type $content_type.
 +
 +
Returns HTTP response code OK.
 +
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 +
<!-- Edit below this comment -->
 +
 +
 +
<!-- Pod2Wiki= -->
 +
</div>
 
<!-- Pod2Wiki=head_see_also -->
 
<!-- Pod2Wiki=head_see_also -->
 
==SEE ALSO==
 
==SEE ALSO==
Line 539: Line 1,059:
 
http://en.wikipedia.org/wiki/Content_negotiation
 
http://en.wikipedia.org/wiki/Content_negotiation
  
 +
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 +
<span style='display:none'>User Comments</span>
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
 +
</div>
 
<!-- Pod2Wiki=head_copyright -->
 
<!-- Pod2Wiki=head_copyright -->
 
==COPYRIGHT==
 
==COPYRIGHT==
Copyright 2000-2011 University of Southampton.
+
{{API:Copyright}}
 
+
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #ccepadding: 0em 1em 0em 1em; font-size: 80%; '>
This file is part of EPrints http://www.eprints.org/.
+
<span style='display:none'>User Comments</span>
 
 
EPrints is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
 
 
 
EPrints 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.  If not, see http://www.gnu.org/licenses/.
 
 
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
<!-- Pod2Wiki=_postamble_ -->
+
</div>
<!-- Edit below this comment -->
+
<!-- Pod2Wiki=_postamble_ --><!-- Edit below this comment -->

Latest revision as of 21:08, 14 December 2021

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


Warning This feature requires EPrints version 3.3.0 or later

Contents

NAME

EPrints::Apache::CRUD - Create, read, update and delete via HTTP

User Comments


SYNOPSIS

 $crud = EPrints::Apache::CRUD->new(
     repository => $repo,
     request => $r,
     datasetid => "eprint",
     dataobjid => "23",
   );
 

User Comments


DESCRIPTION

The CRUD (Create/Read/Update/Delete) module provides the Web API for manipulating content on the server. The API is an AtomPub implementation that exposes Import and Export plugins via simple URLs and HTTP content type negotiation.

You should use the <link> entries in the repository's home page to locate the CRUD endpoint, as they may change in the future:

 <link rel="Sword" href="https://myrepo/sword-app/servicedocument" />
 <link rel="SwordDeposit" href="https://myrepo/id/contents" />
 

User Comments


Examples

Create a new eprint based on a single file:

 curl -X POST \
   -i \
   -u user:password \
   -d 'Hello, World!' \
   -H 'Content-Type: text/plain' \
   https://myrepo/id/contents
 
 HTTP/1.1 201 Created
 Content-Type: application/atom+xml;charset=utf-8
 ...
 

Add a file to an existing eprint:

 curl -X POST \
   -i \
   -u user:password \
   -d 'Hello, World!' \
   -H 'Content-Disposition: attachment; filename=hello.txt' \
   -H 'Content-Type: text/plain' \
   https://myrepo/id/eprint/23/contents
 
 HTTP/1.1 201 Created
 Content-Type: application/atom+xml;charset=utf-8
 ...
 

Get an eprint's metadata in Atom XML:

 curl -X GET \
   -i \
   -u user:password \
   -H 'Accept: application/atom+xml' \
   https://myrepo/id/eprint/23
 
 HTTP/1.1 200 OK
 Content-Type: application/atom+xml;charset=utf-8
 ...
 

Get the list of contents (documents) of an eprint in Atom XML:

 curl -X GET \
   -i \
   -u user:password \
   -H 'Accept: application/atom+xml' \
   https://myrepo/id/eprint/23/contents
 
 HTTP/1.1 200 OK
 Content-Type: application/atom+xml;charset=utf-8
 ...
 

You can find more examples in the tests/84_sword.t unit test.

User Comments


URI layout

These URIs are relative to your EPrints HTTP/HTTPs root.

User Comments


/id/contents GET,HEAD,OPTIONS,POST

Requires authentication.

GET a list of the eprints owned by the user. POST to create a new EPrint object.

User Comments


/id/[datasetid]/[dataobjid] DELETE,GET,HEAD,OPTIONS,PUT

Requires authentication depending on user's privileges and object visibility.

GET an object's metadata or, for File objects, the file content. PUT to replace the metadata and/or contents (see Updating complex objects using PUT). If the object does not exist will attempt to create it with the given dataobjid (requires 'upsert' privilege).

User Comments


/id/[datasetid]/[dataobjid]/contents DELETE,GET,HEAD,OPTIONS,POST,PUT

Requires authentication depending on user's privileges and object visibility.

GET the logical contents of the object: documents for eprints or files for documents. PUT to replace the existing contents or POST to add to the existing contents.

User Comments


HTTP Content Negotiation

GET/HEAD requests are processed using Export plugins. POST/PUT requests are processed using Import plugins.

The plugin used depends on the request's Accept (GET/HEAD) or Content-Type (POST/PUT) header and the type of object being acted on. For example, the following request:

 GET /id/eprint/23 HTTP/1.1
 Accept: application/vnd.eprints.data+xml
 

Will search for an Export plugin that accepts objects of type dataobj/eprint and can produce output in the MIME type application/vnd.eprints.data+xml. This will most likely be the EP3 XML plugin.

In addition to the general plugin negotiation behaviour some special cases are supported to improve compatibility with Atom Pub/Web Browser clients:

User Comments


/id/eprint/...

Requesting EPrint objects as text/html will result in a 303 Redirect to the eprint object's abstract page or, if the eprint is not public, its View page.

User Comments


/id/document/.../contents

Requesting the /contents of a Document object will return the content of the document's main file.

User Comments


/id/file/...

Requesting a File object with no Accept header (or */*) will return the file's content.

User Comments


POST /id/.../contents

When creating new records via POST, content negotiation is performed against the Import plugins.

If no Import plugin supports the Content-Type header the content will be treated as application/octet-stream and stored in a new object. The resulting Atom entry will describe the new object (e.g. the eprint object in which the new document and file objects were created).

Otherwise, the result will depend on the Import plugin's output. Import plugins may produce a single object, multiple objects or an object plus content file(s).

User Comments


Content-Type header

If no Content-Type header is given the MIME type defaults to application/octet-stream for POSTs and PUTs.

User Comments


Content-Disposition header

If the Content-Disposition header is missing or does not contain a filename parameter the filename defaults to main.bin for POSTs and PUTs.

User Comments


Updating complex objects using PUT

Eprint objects contain zero or more documents, which each contain zero or more files. When you update (PUT) an eprint object the contained documents will only be replaced if the Import plugin defines new documents e.g. the Atom Import plugin will never define new documents so PUTing Atom content will only update the eprint's metadata. PUTing EP3 XML will replace the documents if you include a <documents> XML element.

PUTing to /contents will always replace all contents - PUTing to /eprint/23/contents is equivalent to DELETE /eprint/23/contents then POST /eprint/23/contents.

User Comments


PUT/DELETE from Javascript

User Comments


Upserting objects with PUT

User Comments


METHODS

User Comments


repository

$repo = $crud->repository()

Returns the current repository.

User Comments


request

$r = $crud->request()

Returns the current Apache2::RequestUtil.

User Comments


method

$method = $crud->method()

Returns the HTTP method.

User Comments


scope

$scope = $crud->scope()

Returns the scope of the action being performed.

User Comments


dataset

$dataset = $crud->dataset()

Returns the current dataset (if any).

User Comments


dataobj

$dataobj = $crud->dataobj()

Returns the current dataobj (if any).

User Comments


field

$field = $crud->field()

Returns the current field (if available);

User Comments


headers

$headers = $crud->headers()

Get the processed headers.

User Comments


options

@verbs = $crud->options()

Returns the available HTTP verbs for the current request.

User Comments


plugin

$plugin = $crud->plugin()

Returns the current plugin (if available).

User Comments


is_write

$bool = $crud->is_write()

Returns true if the request is not a read-only method.

User Comments


accept_type

$accept_type = $crud->accept_type()

Returns the EPrints type for the current request.

User Comments


check_packaging

$rc = $crud->check_packaging()

Check the Packaging header is ok, if given.

User Comments


resolve_relations

$dataobj = $crud->resolve_relations( $dataobj [, @relations ] )

Resolve the relation path from $dataobj and return the resulting dataobj.

Returns undef if there is no such related object.

User Comments


authen

$rc = $crud->authen

Returns HTTP code based of whether CRUD request can be authenticated.

User Comments


authz

$rc = $crud->authz

Returns HTTP code based of whether CRUD request can be authorized.

User Comments


parse_input

$list = $crud->parse_input( $plugin, $f [, %params ] )

Parse the content submitted by the user using the given $plugin. $f is called by epdata_to_dataobj to convert epdata to a dataobj.  %params are passed to the plugin's input_fh method.

Returns undef on error.

User Comments


create_dataobj

$dataobj = $crud->create_dataobj( $owner, $epdata )

Creates data object as user $owner with metadata from $epdata

Returns an EPrints::DataObj

User Comments


import_plugins

@plugins = $crud->import_plugins( [ %params ] )

Returns all matching import plugins against %params ordered by descending 'q' score.

User Comments


export_plugins

@plugins = $crud->export_plugins( [ %params ] )

Returns all matching export plugins against %params ordered by descending 'q' score.

User Comments


content_negotiate_best_plugin

$plugin = $crud->content_negotiate_best_plugin()

Work out the best plugin to export/update an object based on the client-headers.

User Comments


crud

EPrints::Apache::CRUD( $media_range )

Takes the $media_range string and returns array of acceptable MIME types. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1 for more detail.

User Comments


handler

$rc = $crud->handler

Handler of CRUD requests.

Returns HTTP response code.

User Comments


delete

$rc = $crud->DELETE()

Handle DELETE requests.

User Comments


http_method_not_allowed

HTTP_METHOD_NOT_ALLOWED

Can't perform DELETE on /id/contents.

User Comments


http_not_found

HTTP_NOT_FOUND

No such object.

User Comments


http_conflict

HTTP_CONFLICT

Lock conflict with another user.

User Comments


http_no_content

HTTP_NO_CONTENT

Successfully removed the object.

User Comments


get

$rc = $crud->GET( [ $owner ] )

Handle GET requests.

User Comments


http_no_content

HTTP_NO_CONTENT

No sub-objects in /id/.../contents.

User Comments


http_not_acceptable

HTTP_NOT_ACCEPTABLE

More than one sub-object in /id/.../contents.

User Comments


http_unsupported_media_type

HTTP_UNSUPPORTED_MEDIA_TYPE

No Export plugin matches the Accept header/object type.

User Comments


http_see_other

HTTP_SEE_OTHER

Redirect to a non-CRUD EPrints page.

User Comments


http_not_found

HTTP_NOT_FOUND

Object not found.

User Comments


http_ok

HTTP_OK

Object outputted successfully.

User Comments


post

$rc = $crud->POST( [ $owner ] )

Handle POST requests.

User Comments


http_method_not_allowed

HTTP_METHOD_NOT_ALLOWED

Can only POST to /id/.../contents.

User Comments


http_bad_request

HTTP_BAD_REQUEST

No plugin for the SWORD Packaging header.

User Comments


http_created

HTTP_CREATED

Object(s) successfully created.

User Comments


put

$rc = $crud->PUT( [ $owner ] )

Handle PUT requests.

User Comments


http_unsupported_media_type

HTTP_UNSUPPORTED_MEDIA_TYPE

No Import plugin matched the Content-Type header/object type.

User Comments


http_range_not_satisfiable

HTTP_RANGE_NOT_SATISFIABLE

Range header is invalid or unsupported for the object type.

User Comments


http_forbidden

HTTP_FORBIDDEN

User does not have permission to create/update the object.

User Comments


http_created

HTTP_CREATED

Object was successfully created.

User Comments


http_no_content

HTTP_NO_CONTENT

Object was successfully updated.

User Comments


put_contents

$rc = $crud->PUT_contents( [ $owner ] )

Equivalent to DELETE /id/.../contents then POST /id/.../contents.

See DELETE and POST.

User Comments


metadata_relevant

$crud->metadata_relevant( $file )

Test and if suitable use $file as metadata source to updatie the associated EPrints::DataObj::EPrint.

User Comments


servicedocument

$crud->servicedocument

Gennerate response containing CRUD service document.

User Comments


on_behalf_of

$rc = $crud->on_behalf_of( $user )

Submit CRUD request on behalf od another user.

Returns HTTPS response code based on wehther request on behalf of is permitted.

User Comments


is_true

$boolean = EPrints::Apache::Crud::is_true( $header )

Tests if $header attribute is true.

User Comments


is_false

$boolean = EPrints::Apache::Crud::is_false( $header )

Tests if $header attribute is false.

User Comments


is_file_ok

$boolean = $crud->is_file_ok( $epdata )

Tests if files with $epdata were uploaded with corruption.

User Comments


process_headers

$boolean = $crud->process_headers

Process headers of CRUD request

User Comments


$boolean

$boolean = $crud->( %opts )

Generate SWORD error documents based on provided %opts.

User Comments


plugin_error

$boolean = $crud->plugin_error( $plugin, $messages )

Generate error message for import $plugin used with $messages provided.

User Comments


generate_error_document

$error_document = EPrints::Apache::Crud::generate_error_document( $repo, %opts )

Return error document for EPrints::Repository $repo using options from %opts.

User Comments


send_response

$rc = $crud->send_response( $status, $content_type, $content )

Output response to CRUD request with HTTP status code $status, content type $content_type.

Returns HTTP response code OK.

User Comments


SEE ALSO

http://en.wikipedia.org/wiki/Create,_read,_update_and_delete

http://en.wikipedia.org/wiki/Content_negotiation

User Comments


COPYRIGHT

© Copyright 2022 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