]> 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)
committerNick Clemens <nick@bywatersolutions.com>
Fri, 14 Sep 2018 20:30:47 +0000 (20:30 +0000)
commitb612ec7a0de5c77ca29a07728664fbd1d8cb7812
tree3e21bdc5ca5abf09a5e4d7fc61f50f52afb32a7e
parent1442499a0b6d6c22c87b7ef9eea4c7cc540e3fce
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>
Koha/REST/V1.pm