Suomeksi (in Finnish): Finnan kirjautumisrajapinta
History
20.3.2017 Initial version
General
Finna includes an API that can be used to determine whether the login credentials given by a user are correct. The API does not return patron information, only a success code. It is only available as agreed.
Character set is always UTF-8 (composed).
Functions
getLoginTargets
https://api.finna.fi/api/v1/auth/getLoginTargets?<parametrit>
Returns a list of available login targets (libraries), where a login request can be made. The response also includes information whether a secondary login field (typically user's last name in addition to library card number and PIN code) is required.
Parameter | Type | Descripion | Allowed Values |
---|---|---|---|
prettyPrint | Number | Whether the JSON is pretty-printed with line feeds | 0 (default), 1 |
lng | String | Language to use |
|
Example request:
https://api.finna.fi/api/v1/auth/getLoginTargets?prettyPrint=1&lng=en-gb
Example response:
{ "targets": [ { "id": "moominvalley", "name": "Moominvalley library", }, { "id": "testi", "name": "Test library", "secondary_login_field_label": "Last Name" } ] }
libraryCardLogin
Returns whether the login was successful and any errors encountered. The parameters must be sent with a POST request (application/x-www-form-urlencoded; charset=utf-8) .
Parameter | Type | Description | Allowed Values |
---|---|---|---|
prettyPrint | Number | Whether the JSON is pretty-printed with line feeds | 0 (default), 1 |
lng | String | Language to use |
|
target | String | Login target, i.e. library | Any id returned by getLoginTargets request |
username | String | User name (library card number) | |
password | String | Password (PIN code) | |
secondary | String | Secondary identification field if getLoginTargets returned a secondary_login_field_label |
Example request (here as a GET request, use a POST request):
https://api.finna.fi/api/v1/auth/libraryCardLogin?target=moominvalley&username=100010&password=12345&secondary=Moominpappa
Example response of a successful login:
{"result":"success","status":"OK"}
Example response of a failed login (invalid user name or password):
{"result":"failure","status":"OK"}
Example response of a failure processing the request e.g. because the library backend is not available:
{"status":"ERROR","statusMessage":"Backend unavailable"}