Patrons endpoint RFC
Jump to navigation
Jump to search
This RFC should be the basis for bug 19784 and related bug reports that could need to be filed.
Actions and routes
The following table presents the current implementation, and the proposed changes.
Description | Action | Current path | Proposed path |
List patrons | GET |
/patrons |
/patrons |
Add patron | POST |
/patrons |
/patrons |
Get a patron | GET |
/patrons/{borrowernumber} |
/patrons/{patron_id} |
Overwrite a patron | PUT |
/patrons/{borrowernumber} |
/patrons/{patron_id} |
Delete a patron | DELETE |
/patrons/{borrowernumber} |
/patrons/{patron_id} |
Partially update a patron | PATCH |
NOT IMPLEMENTED |
/patrons/{patron_id} |
Patron object definition
DB schema | Current API | tcohen | Katrin | |
borrowernumber | borrowernumber | patron_id | patron_id | |
cardnumber | cardnumber | |||
surname | surname | |||
firstname | firstname | |||
title | title | |||
othernames | othernames | other_name | ||
initials | initials | |||
streetnumber | streetnumber | street_number | street_number | |
streettype | streettype | street_type | street_type | |
address | address | |||
address2 | address2 | |||
city | city | |||
state | state | |||
zipcode | zipcode | zip | zip_code If changed here, should be changed for B_zipcode and altcontactzipcode too. | |
country | country | |||
phone | phone | |||
mobile | mobile | |||
fax | fax | |||
emailpro | emailpro | secondary_email or similar as there is nothing indicationg 'pro' or 'professional' in the GUI any longer. | ||
phonepro | phonepro | secondary_phone | ||
B_streetnumber | B_streetnumber | altaddress_streetnumber I think the same is true here, B has no meaning for us anymore. Should indicate somehow that this is 'alternate address' in the GUI. | ||
B_streettype | B_streettype | altaddress_streettype | ||
B_address | B_address | altaddress_address | ||
B_address2 | B_address2 | altaddress_address2 | ||
B_city | B_city | altaddress_city | ||
B_state | B_state | altaddress_state | ||
B_zipcode | B_zipcode | altaddress_zip_code | ||
B_country | B_country | altaddress_country | ||
B_email | B_email | altaddress_email | ||
B_phone | B_phone | altaddress_phone | ||
dateofbirth | dateofbirth | date_of_birth | ||
branchcode | branchcode | library_id | library_id | |
categorycode | categorycode | category_id | category_id | |
dateenrolled | dateenrolled | date_enrolled | date_enrolled | |
dateexpiry | dateexpiry | expiry_date | expiry_date | |
date_renewed | date_renewed | date_renewed | ||
gonenoaddress | gonenoaddress | incorrect_address | ||
lost | lost | patron_card_lost | ||
NOT PRESENT | NOT PRESENT | restricted (boolean,ro) | ro = read only, use restrictions routes for more info. Ok for me. | |
debarred | debarred | REMOVED | Separate API? | |
debarredcomment | debarredcomment | REMOVED | Separate API? | |
contactname | contactname | contact_name [1] | If this can't be used from GUI, should probably not be included in the API. | |
contactfirstname | contactfirstname | contact_firstnames [1] | If this can't be used from GUI, should probably not be included in the API. | |
contacttitle | contacttitle | contact_titles [1] | If this can't be used from GUI, should probably not be included in the API. | |
guarantorid | guarantorid | guarantor_id | guarantor_id | |
borrowernotes | borrowernotes | notes | staff_notes | |
relationship | relationship | relationship_type | ||
sex | sex | gender | ||
password | REMOVED | |||
flags | flags | staff_permissions | ||
userid | userid | |||
opacnote | opacnote | opac_notes | opac_notes | |
contactnote | contactnote | contact_notes [1] | contact_note | |
sort1 | sort1 | statistics_1 The naming of this field is confusing in the GUI as well. Maybe we could think about something better. | ||
sort2 | sort2 | statistics_2 | ||
altcontactfirstname | altcontactfirstname | altcontact_firstname | ||
altcontactsurname | altcontactsurname | altcontact_surname | ||
altcontactaddress1 | altcontactaddress1 | altcontact_address | ||
altcontactaddress2 | altcontactaddress2 | altcontact_address2 | ||
altcontactaddress3 | altcontactaddress3 | altcontact_city | ||
altcontactstate | altcontactstate | altcontact_state | ||
altcontactzipcode | altcontactzipcode | altcontact_zip_code | ||
altcontactcountry | altcontactcountry | altcontact_country | ||
altcontactphone | altcontactphone | altcontact_phone | ||
smsalertnumber | smsalertnumber | sms_number | ||
sms_provider_id | sms_provider_id | |||
privacy | privacy | |||
privacy_guarantor_checkouts | privacy_guarantor_checkouts | |||
checkprevcheckout | checkprevcheckout | check_previous_checkout | ||
updated_on | updated_on | |||
lastseen | lastseen | last_seen | last_seen | |
lang | lang | |||
login_attempts | login_attempts | |||
overdrive_auth_token | overdrive_auth_token |
- [1] This fields usage is not clearly defined through my code review. Comments from other devs is required (tcohen).
Notes
- Debarments information is calculated and filled by Koha::Patron::Debarments. We shouldn't send the wrong message to API consumers that those fields can be updated through this endpoint. A /patrons/{patron_id}/restrictions endpoint needs to be added, and a boolean should be exposed on patron objects.