Kohan rajapinnan kuvaus löytyy, kun KOHAn osoitteeseen lisätään perään /api/v1/doc . Swaggerin kautta voi helposti kokeilla tietojen viemistä KOHAan.
Esimerkkinä HAMKin sovellus asiakastietojen tuontiin:
HAMKissa opiskelijoiden tiedot tuodaan KOHAn mobiilisovelluksen (HAMK App) kautta. Asiakkaiden HAMK-tunnus (UPN-tunnus) on tallennettu KOHAan toissijaiseksi sähköpostiosoitteeksi (emailpro-kenttä) ja sitä käytetään tunnistamaan onko asiakkaan tiedot jo kirjastojärjestelmän rekisterissä.
Asiakastiedot tuodaan rajapinnan Patron/Post -komennolla
Asiakkaiden viestiasetukset saadaan seuraavasti:
- kysy ensin asiakaskategorian mukaiset oletusasetukset get /messaging_preferences
- asiakkaan viestiasetukset viedään seuraavalla komennolla put /messaging_preferences
Rajapinnan kautta Patron post -komennolla ei saa kuljetettua lisäkenttiä kuten HETU, tilastointiryhmä, viestiasetukset. Joten nämä tiedot pitää tarkistaa, kun asiakas tulee kirjastoon ja hänelle aktivoidaan kortti.
Asiakkaista tuodaan seuraavat tiedot:
Tieto | Rajapinnan kenttä | Lisätieto |
---|---|---|
Etunimi | firstname | |
Sukunimi | surname | |
Katuosoite | address | |
Postinumero | zipcode | |
UPN | emailpro | HAMKin tunnus. Tämän avulla tarkistetaan, onko asiakas jo rekisterissä |
Puhelinnumero | phone | |
Syntymäaika | dateofbirth | muodossa YYYY-MM-DD |
PIN-koodi | password | Jos halutaan oletuskoodi |
Asiakkaan kotikirjasto | branchcode | Toimipaikka, jossa asiakas (useimmiten) asioi |
Asiakkaan asiakastyyppi | categorycode | Asiakastyypin koodi (patron category code), esim. B = opiskelija, A = henkilökunta |
Huomautus | borrowernotes | Huomautus, joka näkyy virkailijatyökalussa: Asiakastiedot lisätty HAMK Appiin kautta <päiväys>. Tarkista yhteystiedot, viestiasetukset, lisää asiakkaan HETU, tilastoryhmä, varaustunnus ja kirjastokortti. |
POST patron kentät
B_address (string,null, optional): first address line of patron's alternate address
B_address2 (string,null, optional): second address line of patron's alternate address
B_city (string,null, optional): city or town of patron's alternate address
B_country (string,null, optional): country of patron's alternate address
B_email (string,null, optional): email address for patron's alternate address
B_phone (string,null, optional): phone number for patron's alternate address
B_state (string,null, optional): state or province of patron's alternate address
B_streetnumber (string,null, optional): street number of patron's alternate address
B_streettype (string,null, optional): street type of patron's alternate address
B_zipcode (string,null, optional): zip or postal code of patron's alternate address
address (string, optional): first address line of patron's primary address
address2 (string,null, optional): second address line of patron's primary address
altcontactaddress1 (string,null, optional): the first address line for the alternate contact for the patron
altcontactaddress2 (string,null, optional): the second address line for the alternate contact for the patron
altcontactaddress3 (string,null, optional): the city for the alternate contact for the patron
altcontactcountry (string,null, optional): the country for the alternate contact for the patron
altcontactfirstname (string,null, optional): first name of alternate contact for the patron
altcontactphone (string,null, optional): the phone number for the alternate contact for the patron
altcontactstate (string,null, optional): the state for the alternate contact for the patron
altcontactsurname (string,null, optional): surname or last name of the alternate contact for the patron
altcontactzipcode (string,null, optional): the zipcode for the alternate contact for the patron
borrowernotes (string,null, optional): a note on the patron's account
borrowernumber (integer, optional): internally assigned user identifier
branchcode (string, optional): code of patron's home branch
cardnumber (string,null, optional): library assigned user identifier
categorycode (string, optional): code of patron's category ,
checkprevcheckout (string, optional): produce a warning for this patron if this item has previously been checked out to this patron if 'yes', not if 'no', defer to category setting if 'inherit'
city (string, optional): city or town of patron's primary address
contactfirstname (string,null, optional): used for children to include first name of guarantor
contactname (string,null, optional): used for children and professionals to include surname or last name of guarantor or organization name
contactnote (string,null, optional): a note related to patron's alternate address
contacttitle (string,null, optional): used for children to include title of guarantor
country (string,null, optional): country of patron's primary address
dateenrolled (string,null, optional): date the patron was added to Koha
dateexpiry (string,null, optional): date the patron's card is set to expire
dateofbirth (string,null, optional): patron's date of birth
debarred (string,null, optional): until this date the patron can only check-in
debarredcomment (string,null, optional): comment on the stop of the patron
email (string,null, optional): primary email address for patron's primary address
emailpro (string,null, optional): secondary email address for patron's primary address
fax (string,null, optional): fax number for patron's primary address
firstname (string,null, optional): patron's first name
gonenoaddress (boolean,null, optional): set to 1 if library marked this patron as having an unconfirmed address
guarantorid (integer,null, optional): borrowernumber used for children or professionals to link them to guarantor or organizations
initials (string,null, optional): initials of the patron
lang (string,null, optional): lang to use to send notices to this patron
lastseen (string,null, optional): last time a patron has been seen (connected at the OPAC or staff interface)
login_attempts (integer,null, optional): number of failed login attemps
lost (boolean,null, optional): set to 1 if library marked this patron as having lost his card
mobile (string,null, optional): the other phone number for patron's primary address
opacnote (string,null, optional): a note on the patron's account visible in OPAC and staff client
othernames (string,null, optional): any other names associated with the patron
overdrive_auth_token (string,null, optional): persist OverDrive auth token
password (string,null, optional): patron's encrypted password
phone (string,null, optional): primary phone number for patron's primary address
phonepro (string,null, optional): secondary phone number for patron's primary address
privacy (integer, optional): patron's privacy settings related to their reading history
privacy_guarantor_checkouts (integer, optional): controls if relatives can see this patron's checkouts
relationship (string,null, optional): used for children to include the relationship to their guarantor
sex (string,null, optional): patron's gender
sms_provider_id (integer,null, optional):the provider of the mobile phone number defined in smsalertnumber
smsalertnumber (string,null, optional): the mobile phone number where the patron would like to receive notices (if SMS turned on)
sort1 (string,null, optional): a field that can be used for any information unique to the library
sort2 (string,null, optional): a field that can be used for any information unique to the library
state (string,null, optional): state or province of patron's primary address
streetnumber (string,null, optional): street number of patron's primary address
streettype (string,null, optional): street type of patron's primary address
surname (string, optional): patron's last name
title (string,null, optional): patron's title
updated_on (string,null, optional): time of last change could be useful for synchronization with external systems (among others)
userid (string,null, optional): patron's login
zipcode (string,null, optional): zip or postal code of patron's primary address
Esimerkki
{
"B_address": null,
"B_address2": null,
"B_city": null,
"B_country": null,
"B_email": null,
"B_phone": null,
"B_state": null,
"B_streetnumber": null,
"B_streettype": null,
"B_zipcode": null,
"address": "Osoite2",
"address2": null,
"altcontactaddress1": null,
"altcontactaddress2": null,
"altcontactaddress3": null,
"altcontactcountry": null,
"altcontactfirstname": null,
"altcontactphone": null,
"altcontactstate": null,
"altcontactsurname": null,
"altcontactzipcode": null,
"borrowernotes": "APIn kautta lisätty asiakas",
"borrowernumber": 0,
"branchcode": "HAMKA",
"cardnumber": null,
"categorycode": "B",
"checkprevcheckout": "",
"city": "Hämeenlinna",
"contactfirstname": null,
"contactname": null,
"contactnote": null,
"contacttitle": null,
"country": null,
"dateenrolled": null,
"dateexpiry": null,
"dateofbirth": "1987-11-13",
"debarred": null,
"debarredcomment": null,
"email": "malliasiakas@net.com",
"emailpro": "malliasiakas@hamk.fi",
"fax": null,
"firstname": "Api",
"gonenoaddress": false,
"guarantorid": 0,
"initials": null,
"lastseen": null,
"login_attempts": 0,
"lost": false,
"mobile": null,
"opacnote": null,
"othernames": "Malliasiakas, Api",
"overdrive_auth_token": null,
"password": "$2a$08$bwDPDvcq/i/IytrRSZkBLOZ6aOz5Plknbgj5VaoFxCoMBuS6nrl1W",
"phone": "98789876",
"phonepro": null,
"privacy": 0,
"privacy_guarantor_checkouts": 0,
"relationship": null,
"sex": null,
"sms_provider_id": 0,
"smsalertnumber": null,
"sort1": null,
"sort2": null,
"state": null,
"streetnumber": "",
"streettype": null,
"surname": "Malliasiakas",
"title": null,
"userid": null,
"zipcode": "13210"
}