https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37640
--- Comment #1 from Aleisha Amohia <[email protected]> --- Created attachment 170303 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=170303&action=edit Bug 37640: Allow patron REST API endpoint to accept cardnumber This enhancement adds a new system preference RESTPatronIDField. It is set to borrowernumber by default, to support the standard behaviour of providing a borrowernumber to the Koha REST API endpoints to identify a patron. When the syspref is set to cardnumber, Koha will identify the patron using a provided cardnumber and not match on borrowernumber at all. This is useful in cases where organisations may want to use the API endpoints to do patron actions, but don't have the borrowernumber, as this is a unique ID generated within Koha. To test: 1. Create a patron in the staff interface. Take note of their borrowernumber. Set the cardnumber to something - a string or an integer - and take note of this too. 2. In another tab, go to the API endpoint for getPatron your OPAC URL/api/v1/patrons/{patron_id} 3. Replace {patron_id} in the URL with the borrowernumber. Confirm your patron's data is returned successfully. 4. Replace {patron_id} in the URL with the cardnumber. Notice an error is thrown. 5. Apply the patch. Install database updates. You may need to regenerate the API spec to make the API changes take effect: https://wiki.koha-community.org/wiki/Rest_Api_HowTo#Step_7:_Regenerate_API_spec . Then restart services. 6. In the staff interface tab, go to Koha Administration -> system preferences. Search for the new preference RESTPatronIDField. Notice it is set to borrowernumber by default. 7. In your API endpoint tab, again replace {patron_id} in the URL with the borrowernumber. Confirm your patron's data is returned successfully. 8. Change the RESTPatronIDField system preference to cardnumber and save. 9. Refresh your API endpoint tab. Replace {patron_id} in the URL with the cardnumber. Confirm your patron's data is returned successfully. Note: it's possible that giving a borrowernumber when the API endpoint is expecting a cardnumber will still return results, and vice versa - if your cardnumber is an integer and happens to also be a borrowernumber. It's important in this case that only one or the other is used to ensure expected results. Sponsored-by: Chartered Accountants Australia and New Zealand -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
