@kenxirwin/alma-search
Version:
Search ExLibris's Alma API for bibliographic records
75 lines (50 loc) • 2.01 kB
Markdown
## Alma Search (npm package)
This is intended to be an importable npm package for searching Alma APIs from ExLibris.
### Requirements
You will need an Alma API key with bib read permissions to use this.
### Installation
```
npm install /alma-search
```
### SearchBibs
The first (only so far) module is SearchBibs. It allows searching by barcode, mms_id, holdings_id, ie_id, representation_id, nz_mms_id, cz_mms_id, or other_system_id.
Import the package with
```
import {SearchBibs} from /alma-search
```
Instantiate the search object with:
```
const searchBibs = new SearchBibs({
baseUrl: 'https://api-na.hosted.exlibrisgroup.com', // or other regional url
apiKey: 'your-api-key',
});
```
For barcode searching use:
```
searchBibs.barcodeLookup('123456789');
```
For other ids, use something like:
```
const response = await searchBibs.bibById({
mms_id: '99939650000541,99939680000541', // supports multiple ids
});
```
Once you receive the bib item record by a lookup process, you can view holdings details looking up by mms_id, e.g.:
```
const response = await searchBibs.holdingsByMmsId('99939650000541');
```
You can get item-level data from an MmsId with:
```
const response = await searchBibs.holdingsItemsByMmsId('99939650000541');
```
or
```
const response = await searchBibs.holdingsItemsByMmsId('99939650000541', {limit: 20, offset: 20});
```
The holdingsItemsByMmsId functions supports all queryString params as well as the holding_id param described in the [documentation](https://developers.exlibrisgroup.com/alma/apis/docs/bibs/R0VUIC9hbG1hd3MvdjEvYmlicy97bW1zX2lkfS9ob2xkaW5ncy97aG9sZGluZ19pZH0vaXRlbXM=/)
You can also follow any of the links returned to you by earlier searches with the `followLink` method. As with other methods, the API key will be added to the search by by the `followLink` method. Example:
```
const response = await searchBibs.followLink(
'https://api-na.hosted.exlibrisgroup.com/almaws/v1/bibs/99939680000541/holdings'
);
```