Bug 24908 - Allow fetching text-formatted MARC data
Summary: Allow fetching text-formatted MARC data
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: REST API (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Tomás Cohen Arazi
QA Contact:
URL:
Keywords:
Depends on: 23677
Blocks: 24237
  Show dependency treegraph
 
Reported: 2020-03-19 15:03 UTC by Tomás Cohen Arazi
Modified: 2020-11-30 21:44 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.05.00, 19.11.06


Attachments
Bug 24908: Unit tests (1.59 KB, patch)
2020-03-19 15:08 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 24908: Add text-formatted MARC support in /biblios/{biblio_id} (2.26 KB, patch)
2020-03-19 15:09 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 24908: Unit tests (1.64 KB, patch)
2020-03-31 21:47 UTC, David Nind
Details | Diff | Splinter Review
Bug 24908: Add text-formatted MARC support in /biblios/{biblio_id} (2.31 KB, patch)
2020-03-31 21:47 UTC, David Nind
Details | Diff | Splinter Review
Bug 24908: Unit tests (1.71 KB, patch)
2020-04-27 11:00 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 24908: Add text-formatted MARC support in /biblios/{biblio_id} (2.38 KB, patch)
2020-04-27 11:00 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi 2020-03-19 15:03:41 UTC
As used in several places (import diff, MARC detail), the /biblios/:biblio_id route should handle the 'text/plain' format and output the $record->as_formatted result.
Comment 1 Tomás Cohen Arazi 2020-03-19 15:08:58 UTC
Created attachment 101028 [details] [review]
Bug 24908: Unit tests
Comment 2 Tomás Cohen Arazi 2020-03-19 15:09:03 UTC
Created attachment 101029 [details] [review]
Bug 24908: Add text-formatted MARC support in /biblios/{biblio_id}

This patch makes the route support requesting (through the Accept
header) the MARC record to be output as formatted text as in
$record->as_formatted.

To test:
1. Apply the unit tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/biblios.t
=> FAIL: Tests fail
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Try the route with your favourite API testing tool (Postman?)
=> SUCCESS: Accept: text/plain returns the expected results
=> SUCCESS: Wrong Accept header returns a list of valid formats, and
includes 'text/plain'.
6. Sign off :-D
Comment 3 David Nind 2020-03-31 21:47:52 UTC
Created attachment 102158 [details] [review]
Bug 24908: Unit tests

Signed-off-by: David Nind <david@davidnind.com>
Comment 4 David Nind 2020-03-31 21:47:56 UTC
Created attachment 102159 [details] [review]
Bug 24908: Add text-formatted MARC support in /biblios/{biblio_id}

This patch makes the route support requesting (through the Accept
header) the MARC record to be output as formatted text as in
$record->as_formatted.

To test:
1. Apply the unit tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/biblios.t
=> FAIL: Tests fail
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Try the route with your favourite API testing tool (Postman?)
=> SUCCESS: Accept: text/plain returns the expected results
=> SUCCESS: Wrong Accept header returns a list of valid formats, and
includes 'text/plain'.
6. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Comment 5 Jonathan Druart 2020-04-27 11:00:08 UTC
Created attachment 103750 [details] [review]
Bug 24908: Unit tests

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 6 Jonathan Druart 2020-04-27 11:00:11 UTC
Created attachment 103751 [details] [review]
Bug 24908: Add text-formatted MARC support in /biblios/{biblio_id}

This patch makes the route support requesting (through the Accept
header) the MARC record to be output as formatted text as in
$record->as_formatted.

To test:
1. Apply the unit tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/biblios.t
=> FAIL: Tests fail
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Try the route with your favourite API testing tool (Postman?)
=> SUCCESS: Accept: text/plain returns the expected results
=> SUCCESS: Wrong Accept header returns a list of valid formats, and
includes 'text/plain'.
6. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 7 Martin Renvoize 2020-04-29 16:36:01 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 8 Joy Nelson 2020-05-08 22:49:45 UTC
backported to 19.11.x for 19.11.06
Comment 9 Lucas Gass 2020-05-15 15:47:35 UTC
missing dependencies for 19.05.x, no backport