Tech Blog

How to use an API to retrieve an Alma Analytics report

Information regarding “How to use an API to retrieve an Alma Analytics report” is available in this blog post, and official doc is available here.

It is possible to both retrieve the data of an Alma Analytics report as well as the paths (locations) of Alma Analytics reports.

In this blog post we will focus on retrieving the data of the Alma Analytics report.

Note that if you are using a web based REST client or the URL bar of a web browser to retrieve (GET) the report then you may need to pay attention to (and sometimes edit) when and how the slashes and spaces are “escaped” (space to %20 and forward slash to %2F).

In the example below we will use the Advanced REST Client Desktop App.

The syntax to retrieve (GET) the report consists of four parts:

  1. The domain.  One of the following three
    https://api-na.hosted.exlibrisgroup.com
    https://api-eu.hosted.exlibrisgroup.com
    https://api-ap.hosted.exlibrisgroup.com
    https://api-ca.hosted.exlibrisgroup.com
    https://api-cn.hosted.exlibrisgroup.com
  2. /almaws/v1/analytics/reports?path=%2F
  3. The path and name of the report
  4. &limit=[numerical value]&col_names=true&apikey=[api key]

For example:

  1. https://api-eu.hosted.exlibrisgroup.com
  2. /almaws/v1/analytics/reports?path=%2F
  3. shared%2FAlma%20University%2FInventory%2FItem%20Count%20by%20Library%20and%20Location
  4. &limit=25&col_names=true&apikey=19471129
https://api-eu.hosted.exlibrisgroup.com/almaws/v1/analytics/reports?path=%2Fshared%2FAlma%20University%2FInventory%2FItem%20Count%20by%20Library%20and%20Location&limit=25&col_names=true&apikey=19471129

ONE

Make sure you have an API key with permissions for area “Analytics”

Access the API key at Build my APIs > Manage API Keys > Add API Key > Add Permission > Analytics

It can be “Read Only” or “Read Write” because in any case this API does only “Read Only”

TWO

Decide which report you wish to retrieve via the API and in the Alma Analytics interface click “open”.

We will use the report “Overlap P and E for titles with LC classification code between H and HZ” in folder “/shared/Alma University/Reports/Titles”

THREE

In the URL of the browser take note of the report path and the name and copy it.  The value will be after “&path=”

Here is our value:

%2Fshared%2FAlma University%2FReports%2FTitles%2FOverlap P and E for titles with LC classification code between H and HZ

FOUR

Put together the API call as described above with the four parts.

  1. https://api-eu.hosted.exlibrisgroup.com
  2. /almaws/v1/analytics/reports?path=%2F
  3. %2Fshared%2FAlma University%2FReports%2FTitles%2FOverlap P and E for titles with LC classification code between H and HZ
  4. &limit=25&col_names=true&apikey=19471129
https://api-eu.hosted.exlibrisgroup.com/almaws/v1/analytics/reports?path=%2Fshared%2FAlma University%2FReports%2FTitles%2FOverlap P and E for titles with LC classification code between H and HZ&limit=25&col_names=true&apikey=l8xx73f47f7b2a67469cb673f12a59cf4958

FIVE

Test it by doing a GET in the Advanced REST Client

See that it works:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><report><QueryResult>
  <ResumptionToken>660E5D99CEE75352B82BB55F54311A4F833D465B7CFE4FDADA85B6B4359A3B956FEF72CB3B4A388E325B28D99AE0D9555C98F160D17368C496602160DDFB492F</ResumptionToken>
  <IsFinished>false</IsFinished>
  <ResultXml>
    <rowset xmlns="urn:schemas-microsoft-com:xml-analysis:rowset">
      <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:saw-sql="urn:saw-sql" targetNamespace="urn:schemas-microsoft-com:xml-analysis:rowset">
        <xsd:complexType name="Row">
          <xsd:sequence>
            <xsd:element maxOccurs="1" minOccurs="0" name="Column0" saw-sql:columnHeading="0" saw-sql:displayFormula="saw_0" saw-sql:tableHeading="" saw-sql:type="integer" type="xsd:int"/>
            <xsd:element maxOccurs="1" minOccurs="0" name="Column1" saw-sql:columnHeading="Author" saw-sql:displayFormula="saw_1" saw-sql:tableHeading="Bibliographic Details" saw-sql:type="varchar" type="xsd:string"/>
            <xsd:element maxOccurs="1" minOccurs="0" name="Column2" saw-sql:columnHeading="MMS Id" saw-sql:displayFormula="saw_2" saw-sql:tableHeading="Bibliographic Details" saw-sql:type="varchar" type="xsd:string"/>
            <xsd:element maxOccurs="1" minOccurs="0" name="Column3" saw-sql:columnHeading="Title (Normalized)" saw-sql:displayFormula="saw_3" saw-sql:tableHeading="Bibliographic Details" saw-sql:type="varchar" type="xsd:string"/>
            <xsd:element maxOccurs="1" minOccurs="0" name="Column4" saw-sql:columnHeading="Classification Code" saw-sql:displayFormula="saw_4" saw-sql:tableHeading="LC Classifications" saw-sql:type="varchar" type="xsd:string"/>
            <xsd:element maxOccurs="1" minOccurs="0" name="Column5" saw-sql:columnHeading="Num of Physical Items (Active)" saw-sql:displayFormula="saw_5" saw-sql:tableHeading="Title Measures" saw-sql:type="double" type="xsd:double"/>
            <xsd:element maxOccurs="1" minOccurs="0" name="Column6" saw-sql:columnHeading="Num of Portfolios (Active)" saw-sql:displayFormula="saw_6" saw-sql:tableHeading="Title Measures" saw-sql:type="double" type="xsd:double"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:schema>
      <Row>
        <Column0>0</Column0>
        <Column1>Cobbs Hoffman, Elizabeth.</Column1>
        <Column2>99163355900121</Column2>
        <Column3>all you need is love the peace corps and the spirit of the 1960s</Column3>
        <Column4>HC</Column4>
        <Column5>0</Column5>
        <Column6>1</Column6>
      </Row>
      <Row>
        <Column0>0</Column0>
        <Column1>Cobbs Hoffman, Elizabeth.</Column1>
        <Column2>991720260000121</Column2>
        <Column3>all you need is love the peace corps and the spirit of the 1960s</Column3>
        <Column4>HC</Column4>
        <Column5>1</Column5>
        <Column6>0</Column6>
      </Row>
      <Row>
        <Column0>0</Column0>
        <Column1>Poulos, Margaret.</Column1>
        <Column2>9975596200121</Column2>
        <Column3>arms and the woman just warriors and greek feminist identity</Column3>
        <Column4>HQ</Column4>
        <Column5>11</Column5>
        <Column6>0</Column6>
      </Row>
      <Row>
        <Column0>0</Column0>
        <Column1>Poulos, Margaret.</Column1>
        <Column2>9976810800121</Column2>
        <Column3>arms and the woman just warriors and greek feminist identity</Column3>
        <Column4>HQ</Column4>
        <Column5>0</Column5>
        <Column6>1</Column6>
      </Row>
      <Row>
        <Column0>0</Column0>
        <Column1>Poulos, Margaret.</Column1>
        <Column2>99162519700121</Column2>
        <Column3>arms and the woman just warriors and greek feminist identity</Column3>
        <Column4>HQ</Column4>
        <Column5>0</Column5>
        <Column6>0</Column6>
      </Row>
      <Row>
        <Column0>0</Column0>
        <Column2>994371280000121</Column2>
        <Column3>concise companion to feminist theory</Column3>
        <Column4>HQ</Column4>
        <Column5>1</Column5>
        <Column6>1</Column6>
      </Row>
      <Row>
        <Column0>0</Column0>
        <Column2>991327300000121</Column2>
        <Column3>economic theory</Column3>
        <Column4>HB</Column4>
        <Column5>14</Column5>
        <Column6>0</Column6>
      </Row>
      <Row>
        <Column0>0</Column0>
        <Column2>992269450000121</Column2>
        <Column3>economic theory</Column3>
        <Column4>HB</Column4>
        <Column5>0</Column5>
        <Column6>9</Column6>
      </Row>
      <Row>
        <Column0>0</Column0>
        <Column1>Richardson, G. B.</Column1>
        <Column2>99163258100121</Column2>
        <Column3>economic theory</Column3>
        <Column4>HB</Column4>
        <Column5>0</Column5>
        <Column6>1</Column6>
      </Row>
      <Row>
        <Column0>0</Column0>
        <Column1>Fourcade, Marion, 1968-</Column1>
        <Column2>9975390100121</Column2>
        <Column3>economists and societies discipline and profession in the united states britain and france 1890s to 1990s</Column3>
        <Column4>HB</Column4>
        <Column5>11</Column5>
        <Column6>0</Column6>
      </Row>
      <Row>
        <Column0>0</Column0>
        <Column1>Fourcade, Marion, 1968-</Column1>
        <Column2>99162526700121</Column2>
        <Column3>economists and societies discipline and profession in the united states britain and france 1890s to 1990s</Column3>
        <Column4>HB</Column4>
        <Column5>0</Column5>
        <Column6>0</Column6>
      </Row>
      <Row>
        <Column0>0</Column0>
        <Column1>Fourcade, Marion, 1968-</Column1>
        <Column2>99164521100121</Column2>
        <Column3>economists and societies discipline and profession in the united states britain and france 1890s to 1990s</Column3>
        <Column4>HB</Column4>
        <Column5>0</Column5>
        <Column6>1</Column6>
      </Row>
      <Row>
        <Column0>0</Column0>
        <Column1>Aslanian, Sebouh David.</Column1>
        <Column2>99163641600121</Column2>
        <Column3>from the indian ocean to the mediterranean the global trade networks of armenian merchants from new julfa</Column3>
        <Column4>HF</Column4>
        <Column5>0</Column5>
        <Column6>1</Column6>
      </Row>
      <Row>
        <Column0>0</Column0>
        <Column1>Aslanian, Sebouh David.</Column1>
        <Column2>99162531700121</Column2>
        <Column3>from the indian ocean to the mediterranean the global trade networks of armenian merchants from new julfa</Column3>
        <Column4>HF</Column4>
        <Column5>0</Column5>
        <Column6>0</Column6>
      </Row>
      <Row>
        <Column0>0</Column0>
        <Column1>Aslanian, Sebouh David.</Column1>
        <Column2>9975602500121</Column2>
        <Column3>from the indian ocean to the mediterranean the global trade networks of armenian merchants from new julfa</Column3>
        <Column4>HF</Column4>
        <Column5>11</Column5>
        <Column6>0</Column6>
      </Row>
      <Row>
        <Column0>0</Column0>
        <Column2>99164880100121</Column2>
        <Column3>future of the dollar</Column3>
        <Column4>HG</Column4>
        <Column5>0</Column5>
        <Column6>1</Column6>
      </Row>
      <Row>
        <Column0>0</Column0>
        <Column1>International Reports, inc.</Column1>
        <Column2>991461910000121</Column2>
        <Column3>future of the dollar</Column3>
        <Column4>HG</Column4>
        <Column5>3</Column5>
        <Column6>0</Column6>
      </Row>
      <Row>
        <Column0>0</Column0>
        <Column2>991121150000121</Column2>
        <Column3>health social care in the community</Column3>
        <Column4>HV</Column4>
        <Column5>6</Column5>
        <Column6>0</Column6>
      </Row>
      <Row>
        <Column0>0</Column0>
        <Column2>991951780000121</Column2>
        <Column3>health social care in the community</Column3>
        <Column4>HV</Column4>
        <Column5>0</Column5>
        <Column6>11</Column6>
      </Row>
      <Row>
        <Column0>0</Column0>
        <Column2>991693350000121</Column2>
        <Column3>journal of the american chamber of commerce in japan</Column3>
        <Column4>HF</Column4>
        <Column5>1</Column5>
        <Column6>0</Column6>
      </Row>
      <Row>
        <Column0>0</Column0>
        <Column2>992650260000121</Column2>
        <Column3>journal of the american chamber of commerce in japan</Column3>
        <Column4>HF</Column4>
        <Column5>0</Column5>
        <Column6>1</Column6>
      </Row>
      <Row>
        <Column0>0</Column0>
        <Column2>991466510000121</Column2>
        <Column3>journal of the american statistical association</Column3>
        <Column4>HA</Column4>
        <Column5>3</Column5>
        <Column6>0</Column6>
      </Row>
      <Row>
        <Column0>0</Column0>
        <Column2>991665030000121</Column2>
        <Column3>journal of the american statistical association</Column3>
        <Column4>HA</Column4>
        <Column5>0</Column5>
        <Column6>0</Column6>
      </Row>
      <Row>
        <Column0>0</Column0>
        <Column2>992179380000121</Column2>
        <Column3>journal of the american statistical association</Column3>
        <Column4>HA</Column4>
        <Column5>0</Column5>
        <Column6>8</Column6>
      </Row>
      <Row>
        <Column0>0</Column0>
        <Column2>992479580000121</Column2>
        <Column3>journal of the statistical society of london</Column3>
        <Column4>HA</Column4>
        <Column5>0</Column5>
        <Column6>1</Column6>
      </Row>
    </rowset>
  </ResultXml>
</QueryResult></report>

Leave a Reply