]> git.koha-community.org Git - koha.git/commit
Bug 21334: Add bibliographic content type definitions
authorTomas Cohen Arazi <tomascohen@theke.io>
Tue, 11 Sep 2018 17:48:15 +0000 (10:48 -0700)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Thu, 20 Sep 2018 14:02:31 +0000 (15:02 +0100)
commit2cec62128c8521618c95fbf5e1b542fab395aa32
tree2601d54d724b0372d921454d19e77ad2db356e74
parentbbd86576ff80126203c7a957aad6885435eb5aaa
Bug 21334: Add bibliographic content type definitions

This patch adds the following content type definitions, to be used by
endpoint authors implementing MARC-related endpoints:

--------------------------------------
| Content-type             | Alias   |
|--------------------------|---------|
| application/marcxml+xml  | marcxml |
| application/marc-in-json | mij     |
| application/marc         | marc    |
--------------------------------------

Code using this aliases will use them like this:
- Suppose you want to output data in MARCXML format:

my $record = cool_method_that_returns_MARC_RECORD();
return $c->render( status => 200, format => 'marcxml', text => $record->as_xml_record );

Note: 'text' by defaults encodes output as UTF-8. If the encoding is not
UTF-8 you should encode the data on your own.

To test:
- Apply this patches
- Run:
  $ kshell
 k$ prove t/db_dependent/Koha/REST/V1.t
=> SUCCESS: Test pass!
- Sign off :-D

Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit b612ec7a0de5c77ca29a07728664fbd1d8cb7812)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Koha/REST/V1.pm