Tech Blog

Access Your Report List with the New Analytics Paths API

The Analytics Report API provides access to any data that can be exposed in an analytics report. The most recent Alma release has introduced a new API in the analytics area – the Report Path API. It takes the analytics catalog path as a URL parameter and returns a list of subdirectories and reports that appear under that path. The API is intended to support a use case in which users are meant to select a report from the catalog.

The analytics catalog is hierarchical so the most appropriate user interface component is a tree control, which is how the catalog is displayed from the analytics design tool seen below. Since the report path API accepts a single path at a time, it’s best to use a tree control which supports lazy loading. In the lazy loading pattern, the report path API can be called whenever a node is opened for the first time.

In a previous blog post, we introduced the Tableau Web Data Connector for Ex Libris Analytics. This powerful tool allows users to integrate data from Alma into Tableau reports and visualizations along with data from other sources. The web data connector requires the report path in order to access the data in the specified report. In the initial version of the web data connector, the user had to provide the report path manually. This is a less-than-idea user experience. However, we can now use the report path API to provide a list of reports and allow the user to navigate to the desired report.

In our implementation, we’re using JSTree, a popular JQuery plugin which supports lazy loading. To handle the lazy load event, we provide an AJAX function in the data property of the initialization function.

  'core' : {
    'data' : function(node, callback) {
      var url = '/almaws/v1/analytics/paths';
        url: url +, 
        type: "GET",
        dataType: "json",
        cache: false,
        beforeSend: function(xhr) { xhr.setRequestHeader('Authorization', 'apikey <<APIKEY>>') },
        success: function(data) { callback(; }

We need to massage the data returned from the report path API to the format which the JSTree expects. For that, we apply a map function to the array returned in the API. The function returns an object with the appropriate text and id. In addition, based on whether the node represents a folder or a report, it sets the icon and disabled state.

function mapNode(node) {
  var report = node.type=="report";
  return {"text": node.value, "id":, "children": (!report), 
    "icon": report ? "glyphicon glyphicon-file" : "",
    "state" : { "disabled" : !report ;

The end result is an efficient user experience to select a report.

Note that like the Analytics Report API, the Path API supports CORS, which we leverage in this example. There are security considerations when using API keys from the client side. See this blog post for more information.

We hope this example will help you get started with your own implementation of the report path API.

Leave a Reply