Hello World by Chad Kluck

API Presentation at ELUNA 2019, Atlanta, GA

You don't need to be a developer to understand the potential of Ex Libris APIs. Of the four major API integration projects undertaken by University of St. Thomas Libraries over the past year, three didn’t even require the library to supply a single line of code. Students and faculty now access their requests, loans, and fines through the university’s portal, we’ve experimented with discovery, request, and renewals using a chat interface, and we will now start to ingest invoices into our campus finance system, all by pitching the power of Ex Libris APIs to potential development partners. For beginners to intermediate, we’ll explore Ex Libris’s API Center, generate your first few API requests (bring your laptop or mobile device!), and introduce Postman (a free API tool). Best practices and security are also covered. Though Alma and Primo APIs are used as implementation examples, the main focus is getting comfortable using and leveraging APIs in general.

This is a presentation I gave at the Ex Libris Users North America (ELUNA) Conference in Atlanta, Georgia, Friday, May 3, 2019.

ELUNA 2019 - Alma Elsewhere (Conference presentation)

St. Thomas Libraries GitHub

Chad Kluck GitHub

Ex Libris Developer's Network


Serverless options

Code to run your own instance of the ELUNA example API:

Helpful GitHub projects

Ex Libris API Example (Load Courses)

PHP Project Framework: A project template to quickly develop your own APIs and microsites

JavaScript Template: A template to quickly develop JavaScript code that calls APIs

Example: 8 Ball

Additional Presentations

This ELUNA presentation was based on/extends the presentation I gave at UMWUG (Upper Midwest User Group) Fall:

More on the Library Help LTI: “Drag, Drop, Done, Implementing Library Help LTI in Canvas” presentation given at LibTech 2019:


User, Loans, Fines, Fees









Search and Request

Perform a search on Primo


When a user selects an item we get the BIB





Make Request


Import Invoices to Finance System

Get Fund Codes


Get Active Invoices


Get Each Vendor (based on invoices)


PHP Code Snippets

Return an array as JSON

// ------------------------------------------------------
// PHP - Return an array as JSON

$data = array();
$data[] = "Hello World"; // put data in the array

$cache = 60; //in seconds
$origin = "https://www.yoursitedomain.com"; // CORS allowed origin

$ts = gmdate("D, d M Y H:i:s", time() + $cache) . " GMT";

header("Expires: ".$ts);
header("Pragma: cache");
header("Cache-Control: max-age=".$cache);
header("Access-Control-Allow-Origin: ".$origin); // CORS
header("Content-type: application/json");
echo json_encode($array);

Request JSON data as an array

// --------------------------------
// PHP - Request json data and turn into array
function getDataFromJSON($url) {
 $results = array();
 try {
 $contents = @file_get_contents($url); // @ means suppress warnings
 $results = json_decode($contents, true);
 } catch (Exception $e) {
 echo "Caught exception: ". $e->getMessage();
 return $results;

$apikey = ""; // enter an API key here - needs access to Courses
$url = "https://api-na.hosted.exlibrisgroup.com/almaws/v1/courses?limit=10&offset=0&order_by=code%2Csection&direction=ASC&format=json&apikey=".$apikey; // change this to whatever you want, be sure the key has access
$data = getDataFromJSON($url);

Related posts