Bug 30799 - Add REST API route to update biblio metadata
Summary: Add REST API route to update biblio metadata
Status: RESOLVED DUPLICATE of bug 31801
Alias: None
Product: Koha
Classification: Unclassified
Component: REST API (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Julian Maurice
QA Contact:
URL:
Keywords:
Depends on:
Blocks: 17371
  Show dependency treegraph
 
Reported: 2022-05-18 12:17 UTC by Julian Maurice
Modified: 2023-03-23 15:05 UTC (History)
4 users (show)

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


Attachments
Bug 30799: Add REST API route to update biblio metadata (7.19 KB, patch)
2022-05-18 12:19 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 30799: Add REST API route to update biblio metadata (7.25 KB, patch)
2022-05-19 10:22 UTC, Paul Derscheid
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Julian Maurice 2022-05-18 12:17:18 UTC

    
Comment 1 Julian Maurice 2022-05-18 12:19:15 UTC
Created attachment 135102 [details] [review]
Bug 30799: Add REST API route to update biblio metadata

Example:

PUT /api/v1/biblios/{biblio_id}/metadata

<record>
...
</record>

Calling this endpoint will replace the current MARC record with the one
given in the request body, by calling C4::Biblio::ModBiblio

Test plan:
1. Try requesting this endpoint with your favorite API tool
2. Run `prove t/db_dependent/api/v1/biblios/metadata/put.t`
Comment 2 Paul Derscheid 2022-05-19 10:22:59 UTC
Created attachment 135197 [details] [review]
Bug 30799: Add REST API route to update biblio metadata

Example:

PUT /api/v1/biblios/{biblio_id}/metadata

<record>
...
</record>

Calling this endpoint will replace the current MARC record with the one
given in the request body, by calling C4::Biblio::ModBiblio

Test plan:
1. Try requesting this endpoint with your favorite API tool
2. Run `prove t/db_dependent/api/v1/biblios/metadata/put.t`

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>

--- Works as advertised. Passes provided test.


Current status: Signed Off
Comment 3 Marcel de Rooy 2022-05-20 06:49:38 UTC
Good to see this one.
Just a dumb question: Would it be useful to allow for partial MARC record updates too instead of replacing the complete MARC record?
Suppose I just want to add one new field somewhere, and not want to risk overwriting the complete MARC record somehow with an older version or so?
Comment 4 Tomás Cohen Arazi 2022-05-21 20:12:46 UTC
(In reply to Marcel de Rooy from comment #3)
> Good to see this one.
> Just a dumb question: Would it be useful to allow for partial MARC record
> updates too instead of replacing the complete MARC record?
> Suppose I just want to add one new field somewhere, and not want to risk
> overwriting the complete MARC record somehow with an older version or so?

That'd be routes that implement the overlay stuff. We should have a call to talk about possible endpoints design.
Comment 5 Marcel de Rooy 2022-06-08 12:26:10 UTC
I still have doubts on thie report.
It seems that we are skipping quite some validations that the interface normally does for us via the frameworks etc.

Can we get more consensus about that first ?
Comment 6 Julian Maurice 2022-06-08 12:51:34 UTC
(In reply to Marcel de Rooy from comment #5)
> I still have doubts on thie report.
> It seems that we are skipping quite some validations that the interface
> normally does for us via the frameworks etc.

Do you mean things like mandatory fields ?
Does this validation happen outside of the editor, for instance when using the import tool ?
Comment 7 Marcel de Rooy 2022-06-08 12:53:22 UTC
(In reply to Julian Maurice from comment #6)
> (In reply to Marcel de Rooy from comment #5)
> > I still have doubts on thie report.
> > It seems that we are skipping quite some validations that the interface
> > normally does for us via the frameworks etc.
> 
> Do you mean things like mandatory fields ?
> Does this validation happen outside of the editor, for instance when using
> the import tool ?

Ha good point. Import will skip them too. When we import and overwrite, we are doing the same..
Comment 8 Tomás Cohen Arazi 2022-06-08 12:55:34 UTC
(In reply to Marcel de Rooy from comment #3)
> Good to see this one.
> Just a dumb question: Would it be useful to allow for partial MARC record
> updates too instead of replacing the complete MARC record?
> Suppose I just want to add one new field somewhere, and not want to risk
> overwriting the complete MARC record somehow with an older version or so?


If we wanted to add a PATCH route, we need to think of it in terms of the MARC overlay rules. Not because it needs to use that particularly (it could) but because we need a way to express the possible behaviors as we did on that dev. In that case there's a form for setting rules, for a PATCH route we would either need to add some payload representing the same, or just pointing to some overlay rule.

This would be really interesting, but certainly a bigger dev and another report.
Comment 9 Katrin Fischer 2022-06-18 21:44:31 UTC
I think a 'full' overwrite if described as such would be a good first step. If we could make it follow overlay rules, maybe by adding a new filter 'REST API'  that would be great.
Comment 10 Julian Maurice 2023-03-23 15:05:58 UTC

*** This bug has been marked as a duplicate of bug 31801 ***