[Bug 23285] New: Add patron PATCH route
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23285 Bug ID: 23285 Summary: Add patron PATCH route Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: REST api Assignee: koha-bugs@lists.koha-community.org Reporter: johanna.raisa@koha-suomi.fi Patron PATCH route is not yet implemented. PUT route is not exactly overwriting all data but there are some parameters which are required. PATCH route should accept updates from one to n fields. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23285 Johanna Räisä <johanna.raisa@koha-suomi.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |johanna.raisa@koha-suomi.fi |ity.org | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23285 --- Comment #1 from Johanna Räisä <johanna.raisa@koha-suomi.fi> --- Created attachment 91426 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=91426&action=edit Bug 23285: Add patrons PATCH route Implementation for patrons PATCH route. Test plan - Apply this patch - Run prove t/db_dependent/api/v1/patrons.t - Create user with borrowers permissions - Authenticate with the user created above and get a CGISESSION id. - Use the CGISESSION to patch patrons via the API - PATCH /patrons/{patron_id} with some parameters in the body Sponsored-by: Koha-Suomi Oy -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23285 Johanna Räisä <johanna.raisa@koha-suomi.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Change sponsored?|--- |Sponsored -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23285 Johanna Räisä <johanna.raisa@koha-suomi.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Add patron PATCH route |Add patrons PATCH route -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23285 Joonas Kylmälä <joonas.kylmala@helsinki.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |In Discussion CC| |joonas.kylmala@helsinki.fi --- Comment #2 from Joonas Kylmälä <joonas.kylmala@helsinki.fi> --- Please make this depend on #23843 so it doesn't conflict with it if it is pushed soon -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23285 Joonas Kylmälä <joonas.kylmala@helsinki.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |23843 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23843 [Bug 23843] Make existing endpoints use Koha::Object(s)->to_api -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23285 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |katrin.fischer@bsz-bw.de --- Comment #3 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Be careful with the "In Discussion" - maybe better to use FQA or back to Assigned? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23285 Johanna Räisä <johanna.raisa@koha-suomi.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|In Discussion |ASSIGNED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23285 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |martin.renvoize@ptfs-europe | |.com --- Comment #4 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Hmm.. At a quick glance this doesn't feel right.. somehow I feel like PATCH operations should utilise something like json-patch and send a list of change operations rather than just a partial copy of a whole object. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23285 --- Comment #5 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- We do have "Update patron" with PUT in the API documentation - does this cover the use case? https://api.koha-community.org/#tag/patrons/operation/updatePatron -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23285 --- Comment #6 from Johanna Räisä <johanna.raisa@koha-suomi.fi> --- (In reply to Katrin Fischer from comment #5)
We do have "Update patron" with PUT in the API documentation - does this cover the use case? https://api.koha-community.org/#tag/patrons/operation/updatePatron
This endpoint is mentioned on this documentation. https://wiki.koha-community.org/wiki/Patrons_endpoint_RFC The difference between PUT and PATCH is that PUT updates the entire resource and PATCH updates only partial of the data without modifying the entire data. At moment if you want to update one value, you need to update them all. I guess Martin's comment was how is the response showed, correct me if I'm wrong. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23285 --- Comment #7 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- (In reply to Johanna Räisä from comment #6)
(In reply to Katrin Fischer from comment #5)
We do have "Update patron" with PUT in the API documentation - does this cover the use case? https://api.koha-community.org/#tag/patrons/operation/updatePatron
This endpoint is mentioned on this documentation. https://wiki.koha-community.org/wiki/Patrons_endpoint_RFC
The difference between PUT and PATCH is that PUT updates the entire resource and PATCH updates only partial of the data without modifying the entire data.
At moment if you want to update one value, you need to update them all.
I guess Martin's comment was how is the response showed, correct me if I'm wrong.
Hi Johanna, I believe we do also support partial with PUT even if it might not be totally clear from documentation. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23285 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fridolin.somers@biblibre.co | |m --- Comment #8 from Fridolin Somers <fridolin.somers@biblibre.com> --- I've tested and I cant do partial update with PUT. I get "missing property" message. I think since for both post and put we define for body : schema: $ref: "../swagger.yaml#/definitions/patron" And in /api/v1/swagger/definitions/patron.yaml we have: required: - surname - library_id - category_id -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23285 --- Comment #9 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- (In reply to Fridolin Somers from comment #8)
I've tested and I cant do partial update with PUT. I get "missing property" message.
I think since for both post and put we define for body : schema: $ref: "../swagger.yaml#/definitions/patron"
And in /api/v1/swagger/definitions/patron.yaml we have: required: - surname - library_id - category_id
It works, but you need to include those three always right now. (I just recently looked into that and we had discussed it on IRC) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23285 --- Comment #10 from Fridolin Somers <fridolin.somers@biblibre.com> --- I've been discussing this in mailing list koha-devel (REST API : PUT for partial update). So we do need a PATCH route. It would be very useful to update for example the expiration date. Is there a way to set required fields outside api/v1/swagger/definitions/patron.yaml so that is can be used in both PATCH,PUT and POST routes ? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23285 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tomascohen@gmail.com --- Comment #11 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Fridolin Somers from comment #10)
I've been discussing this in mailing list koha-devel (REST API : PUT for partial update).
So we do need a PATCH route. It would be very useful to update for example the expiration date.
Is there a way to set required fields outside api/v1/swagger/definitions/patron.yaml so that is can be used in both PATCH,PUT and POST routes ?
The way to do it, implies loosing reusability of the object definitions, which I don't think is a big deal anyway. We would just need to be observant on any attribute changes so they are applied both in patron.yaml and (say) patron_patch.yaml. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org