![]() |
Grima
2018-08
Whispering into Alma's ear
|
grima-lib.php - a library for running API calls in Alma More...
Public Member Functions | |
| session_init ( $force=false) | |
| session_save ($result) | |
| session_destroy () | |
| __construct () | |
| get_config () | |
| get ($url, $URLparams, $QSparams) | |
| general function for GET (retrieve) API calls More... | |
| post ($url, $URLparams, $QSparams, $body) | |
| general function for POST (create) API calls More... | |
| put ($url, $URLparams, $QSparams, $body) | |
| general function for PUT (update) API calls More... | |
| delete ($url, $URLparams, $QSparams) | |
| general function for DELETE API calls More... | |
| checkForErrorMessage ($xml) | |
| checks for errorMessage tag, throws exceptions More... | |
Bib APIs | |
| getBib ($mms_id, $view='full', $expand='None') | |
| Retrieve Bib - retrieve a bib record from Alma. More... | |
| postBib ($bib) | |
| Create Record - adds a new bib record to Alma. More... | |
| putBib ($mms_id, $bib) | |
| Update Bib Record - updates the copy of the bib in Alma. More... | |
| deleteBib ($mms_id, $override='false') | |
| Delete Bib Record - deletes the bib record from Alma. More... | |
Holdings List APIs | |
| getHoldingsList ($mms_id) | |
| Retrieve Holdings list - download brief descriptions of holdings for the bib. More... | |
Holding APIs | |
| getHolding ($mms_id, $holding_id) | |
| Retrieve Holdings Record - retrieve holdings record from Alma. More... | |
| postHolding ($mms_id, $holding) | |
| Create holding record - add a new holdings record to a bib. More... | |
| putHolding ($mms_id, $holding_id, $holding) | |
| Update Holdings Record - replace the holdings record in Alma. More... | |
| deleteHolding ($mms_id, $holding_id, $override='false') | |
| Delete Holdings Record - delete the holdings record from Alma. More... | |
Item List APIs | |
| getItemList ($mms_id, $holding_id, $limit, $offset) | |
| Retrieve Items list - retrieve the items list from a holding or bib from Alma. More... | |
Item APIs | |
| getItem ($mms_id, $holding_id, $item_pid) | |
| Retrieve Item and print label information. More... | |
| getItemBC ($barcode) | |
| Retrieve Item and print label information (by barcode)) More... | |
| postItem ($mms_id, $holding_id, $item) | |
| Create Item - add a new item to a holding in Alma. More... | |
| putItem ($mms_id, $holding_id, $item_pid, $item) | |
| Update Item information - replace item record in Alma. More... | |
| deleteItem ($mms_id, $holding_id, $item_pid, $override="false", $holdings="retain") | |
| Withdraw Item - delete an item record from Alma. More... | |
Electronic APIs | |
| getElectronicPortfolio ($collection_id, $service_id, $portfolio_id) | |
| Retrieve Portfolio - retrieve a portfolio record from Alma. More... | |
| getElectronicPortfolioFromBib ($mms_id, $portfolio_id) | |
| Retrieve Portfolio - retrieve a portfolio record from Alma. More... | |
| postElectronicPortfolio ($collection_id, $service_id, $portfolio) | |
| Create Electronic Portfolio - add a new portfolio to Alma. More... | |
| postElectronicPortfolioOnBib ($mms_id, $portfolio) | |
| Create Electronic Portfolio - add a new portfolio to Alma Bib. More... | |
| putElectronicPortfolioOnBib ($mms_id, $portfolio_id, $portfolio) | |
| Update Electronic Portfolio - update portfolio in Alma. More... | |
| deleteElectronicPortfolio ($collection_id, $service_id, $portfolio_id) | |
| Delete Electronic Portfolio - delete portfolio from Alma. More... | |
| getElectronicPortfoliosForService ($collection_id, $service_id, $limit, $offset) | |
| Retrieve Portfolios - retrieve a list of portfolios from Alma. More... | |
| getElectronicPortfoliosForBib ($mms_id, $limit, $offset) | |
| Retrieve Portfolios list (Bib) - retrieve a list of portfolios from Alma. More... | |
| getElectronicCollection ($collection_id) | |
| Retrieve Electronic Collection - retrieve a collection record from Alma. More... | |
| getElectronicServices ($collection_id) | |
| Retrieve Electronic Services - retrieve a list of services from a collection in Alma. More... | |
Library APIs | |
| getLibrary ($libraryCode) | |
| Retrieve a Library - retrieve a Library from Alma. More... | |
Location APIs | |
| getLocation ($libraryCode, $locationCode) | |
| Retrieve Location - retrieve a Library Location from Alma. More... | |
Set APIs | |
| getSet ($set_id) | |
| Retrieve a Set - retrieve a Set from Alma. More... | |
| createSetFromImport ($job_instance_id, $population) | |
| Create a Set from an import job. More... | |
| deleteSet ($set_id) | |
| Delete a Set - delete a set (not its items) from Alma. More... | |
| getSetMembers ($set_id, $limit=10, $offset=0) | |
| get the members of a set, IF IT WORKS?!?! More... | |
Analytics APIs | |
| getAnalytics ($path, $filter, $limit=25, $token=null) | |
Public Attributes | |
| $server | |
| $apikey | |
grima-lib.php - a library for running API calls in Alma
(c) 2019 Kathryn Lybarger. CC-BY-SA
Definition at line 14 of file grima-lib.php.
| Grima::__construct | ( | ) |
Definition at line 60 of file grima-lib.php.
References get_config().
| Grima::checkForErrorMessage | ( | $xml | ) |
checks for errorMessage tag, throws exceptions
| DomDocument | $xml |
Definition at line 298 of file grima-lib.php.
Referenced by createSetFromImport(), deleteBib(), deleteElectronicPortfolio(), deleteHolding(), deleteItem(), deleteSet(), getBib(), getElectronicCollection(), getElectronicPortfolio(), getElectronicPortfolioFromBib(), getElectronicPortfoliosForBib(), getElectronicPortfoliosForService(), getElectronicServices(), getHolding(), getHoldingsList(), getItem(), getItemBC(), getItemList(), getLibrary(), getLocation(), getSet(), getSetMembers(), postBib(), postElectronicPortfolio(), postElectronicPortfolioOnBib(), postHolding(), postItem(), putBib(), and putElectronicPortfolioOnBib().
| Grima::createSetFromImport | ( | $job_instance_id, | |
| $population | |||
| ) |
Create a Set from an import job.
Makes a call to the API: (API docs)
POST /almaws/v1/conf/sets
| string | $job_instance_id | ID of the import job |
| string | $population | ... |
Definition at line 1060 of file grima-lib.php.
References checkForErrorMessage(), and post().
| Grima::delete | ( | $url, | |
| $URLparams, | |||
| $QSparams | |||
| ) |
general function for DELETE API calls
| string | $url | - URL pattern string with parameters in {} |
| array | $URLparams | - URL parameters |
| array | $QSparams | - query string parameters |
Definition at line 260 of file grima-lib.php.
| Grima::deleteBib | ( | $mms_id, | |
$override = 'false' |
|||
| ) |
Delete Bib Record - deletes the bib record from Alma.
Makes a call to the API: (API docs)
DELETE /almaws/v1/bibs/{mms_id}
| string | $mms_id | MMS ID of Alma Bib record to delete |
| string | $override | Optional. Default=false |
Definition at line 399 of file grima-lib.php.
References checkForErrorMessage().
| Grima::deleteElectronicPortfolio | ( | $collection_id, | |
| $service_id, | |||
| $portfolio_id | |||
| ) |
Delete Electronic Portfolio - delete portfolio from Alma.
Makes a call to the API: (API docs)
DELETE /almaws/v1/electronic/e-collections/{collection_id}/e-services/{service_id}/portfolios/{portfolio_id}
| string | $collection_id | ID of collection |
| string | $service_id | ID of service |
| string | $portfolio_id | ID of portfolio |
Definition at line 849 of file grima-lib.php.
References checkForErrorMessage().
| Grima::deleteHolding | ( | $mms_id, | |
| $holding_id, | |||
$override = 'false' |
|||
| ) |
Delete Holdings Record - delete the holdings record from Alma.
Makes a call to the API: (API docs)
DELETE /almaws/v1/bibs/{mms_id}/holdings/{holding_id}
| string | $mms_id | MMS ID of Alma Bib record |
| string | $holding_id | Holding ID of Holding record to delete from Alma |
| string | $override | Optional. Default=false |
Definition at line 531 of file grima-lib.php.
References checkForErrorMessage().
| Grima::deleteItem | ( | $mms_id, | |
| $holding_id, | |||
| $item_pid, | |||
$override = "false", |
|||
$holdings = "retain" |
|||
| ) |
Withdraw Item - delete an item record from Alma.
Makes a call to the API: (API docs)
DELETE /almaws/v1/bibs/{mms_id}/holdings/{holding_id}/items/{item_pid}
| string | $mms_id | MMS ID of Bib record |
| string | $holding_id | Holding ID of holding record |
| string | $item_pid | Item ID of item record |
| string | $override | Override warnings? (false, true) |
| string | $holdings | How to handle holdings with inventory? (retain, delete or suppress) |
Definition at line 695 of file grima-lib.php.
References checkForErrorMessage().
| Grima::deleteSet | ( | $set_id | ) |
Delete a Set - delete a set (not its items) from Alma.
Makes a call to the API: (API docs)
DELETE /almaws/v1/conf/sets/{set_id}
| string | $set_id | Set ID |
Definition at line 1111 of file grima-lib.php.
References checkForErrorMessage().
| Grima::get | ( | $url, | |
| $URLparams, | |||
| $QSparams | |||
| ) |
general function for GET (retrieve) API calls
| string | $url | - URL pattern string with parameters in {} |
| array | $URLparams | - URL parameters |
| array | $QSparams | - query string parameters |
Definition at line 130 of file grima-lib.php.
| Grima::get_config | ( | ) |
Definition at line 64 of file grima-lib.php.
References session_init(), and session_save().
Referenced by __construct().
| Grima::getAnalytics | ( | $path, | |
| $filter, | |||
$limit = 25, |
|||
$token = null |
|||
| ) |
Definition at line 1153 of file grima-lib.php.
| Grima::getBib | ( | $mms_id, | |
$view = 'full', |
|||
$expand = 'None' |
|||
| ) |
Retrieve Bib - retrieve a bib record from Alma.
Makes a call to the API: (API docs)
GET /almaws/v1/bibs/{mms_id}
| string | $mms_id | The Bib Record ID. |
| string | $view | Optional. Default=full |
| string | $expand | Optional. Default=None |
Definition at line 330 of file grima-lib.php.
References checkForErrorMessage().
| Grima::getElectronicCollection | ( | $collection_id | ) |
Retrieve Electronic Collection - retrieve a collection record from Alma.
Makes a call to the API: (API docs)
GET /almaws/v1/electronic/e-collections/{collection_id}
| string | $collection_id | ID of collection |
Definition at line 919 of file grima-lib.php.
References checkForErrorMessage().
| Grima::getElectronicPortfolio | ( | $collection_id, | |
| $service_id, | |||
| $portfolio_id | |||
| ) |
Retrieve Portfolio - retrieve a portfolio record from Alma.
Makes a call to the API: (API docs)
GET /almaws/v1/electronic/e-collections/{collection_id}/e-services/{service_id}/portfolios/{portfolio_id}
| string | $collection_id | ID of collection |
| string | $service_id | ID of service |
| string | $portfolio_id | ID of portfolio |
Definition at line 731 of file grima-lib.php.
References checkForErrorMessage().
| Grima::getElectronicPortfolioFromBib | ( | $mms_id, | |
| $portfolio_id | |||
| ) |
Retrieve Portfolio - retrieve a portfolio record from Alma.
Makes a call to the API: (API docs)
GET /almaws/v1/bibs/{mms_id}/portfolios/{portfolio_id}
| string | $mms_id | ID of bib record |
| string | $portfolio_id | ID of portfolio |
Definition at line 754 of file grima-lib.php.
References checkForErrorMessage().
| Grima::getElectronicPortfoliosForBib | ( | $mms_id, | |
| $limit, | |||
| $offset | |||
| ) |
Retrieve Portfolios list (Bib) - retrieve a list of portfolios from Alma.
Makes a call to the API: (API docs)
GET /almaws/v1/bibs/{mms_id}/portfolios
| string | $mms_id | ID of bib |
| string | $limit | Max number of portfolios to retrieve |
| string | $offset | Offset of the results |
Definition at line 897 of file grima-lib.php.
References checkForErrorMessage().
| Grima::getElectronicPortfoliosForService | ( | $collection_id, | |
| $service_id, | |||
| $limit, | |||
| $offset | |||
| ) |
Retrieve Portfolios - retrieve a list of portfolios from Alma.
Makes a call to the API: (API docs)
GET /almaws/v1/electronic/e-collections/{collection_id}/e-services/{service_id}/portfolios
| string | $collection_id | ID of collection |
| string | $service_id | ID of service |
| string | $limit | Max number of portfolios to retrieve |
| string | $offset | Offset of the results |
Definition at line 873 of file grima-lib.php.
References checkForErrorMessage().
| Grima::getElectronicServices | ( | $collection_id | ) |
Retrieve Electronic Services - retrieve a list of services from a collection in Alma.
Makes a call to the API: (API docs)
GET /almaws/v1/electronic/e-collections/{collection_id}/e-services
| string | $collection_id | ID of collection |
Definition at line 942 of file grima-lib.php.
References checkForErrorMessage().
| Grima::getHolding | ( | $mms_id, | |
| $holding_id | |||
| ) |
Retrieve Holdings Record - retrieve holdings record from Alma.
Makes a call to the API: (API docs)
GET /almaws/v1/bibs/{mms_id}/holdings/{holding_id}
Definition at line 458 of file grima-lib.php.
References checkForErrorMessage().
| Grima::getHoldingsList | ( | $mms_id | ) |
Retrieve Holdings list - download brief descriptions of holdings for the bib.
Makes a call to the API: (API docs)
GET /almaws/v1/bibs/{mms_id}/holdings
| string | $mms_id | MMS ID of Alma Bib to gather holdings from |
Definition at line 428 of file grima-lib.php.
References checkForErrorMessage().
| Grima::getItem | ( | $mms_id, | |
| $holding_id, | |||
| $item_pid | |||
| ) |
Retrieve Item and print label information.
Makes a call to the API: (API docs)
GET /almaws/v1/bibs/{mms_id}/holdings/{holding_id}/items/{item_pid}
| string | $mms_id | MMS ID of Alma Bib |
| string | $holding_id | Holding ID of Alma Holding |
| string | $item_pid | Item ID of Alma Holding |
Definition at line 594 of file grima-lib.php.
References checkForErrorMessage().
| Grima::getItemBC | ( | $barcode | ) |
Retrieve Item and print label information (by barcode))
Makes a call to the API: (API docs)
GET /almaws/v1/items?item_barcode={item_barcode}
| string | $barcode | Barcode of Alma item |
Definition at line 618 of file grima-lib.php.
References checkForErrorMessage().
| Grima::getItemList | ( | $mms_id, | |
| $holding_id, | |||
| $limit, | |||
| $offset | |||
| ) |
Retrieve Items list - retrieve the items list from a holding or bib from Alma.
Makes a call to the API: (API docs)
GET /almaws/v1/bibs/{mms_id}/holdings/{holding_id}/items
| string | $mms_id | MMS ID of Alma bib |
| string | $holding_id | MMS ID of Alma holding |
| string | $limit | Max number of items to retrieve |
| string | $offset | Offset of the results returned |
Definition at line 565 of file grima-lib.php.
References checkForErrorMessage().
| Grima::getLibrary | ( | $libraryCode | ) |
Retrieve a Library - retrieve a Library from Alma.
Makes a call to the API: (API docs)
GET /almaws/v1/conf/libraries/{libraryCode}
| string | $libraryCode | ID of the library to retrieve |
Definition at line 971 of file grima-lib.php.
References checkForErrorMessage().
| Grima::getLocation | ( | $libraryCode, | |
| $locationCode | |||
| ) |
Retrieve Location - retrieve a Library Location from Alma.
Makes a call to the API: (API docs)
GET /almaws/v1/conf/libraries/{libraryCode}/locations/{locationCode}
| string | $libraryCode | ID of the library to retrieve |
Definition at line 1000 of file grima-lib.php.
References checkForErrorMessage().
| Grima::getSet | ( | $set_id | ) |
Retrieve a Set - retrieve a Set from Alma.
Makes a call to the API: (API docs)
GET /almaws/v1/conf/sets/{set_id}
| string | $set_id | ID of the set to retrieve |
Definition at line 1032 of file grima-lib.php.
References checkForErrorMessage().
| Grima::getSetMembers | ( | $set_id, | |
$limit = 10, |
|||
$offset = 0 |
|||
| ) |
get the members of a set, IF IT WORKS?!?!
Makes a call to the API: (API docs)
GET /almaws/v1/conf/sets/{set_id}/members
| string | $set_id | Set ID |
| number | $limit | How many to return at most (default 10) |
| number | $offset | Where to start from, for continuation (default 0, the beginning) |
Definition at line 1135 of file grima-lib.php.
References checkForErrorMessage().
| Grima::post | ( | $url, | |
| $URLparams, | |||
| $QSparams, | |||
| $body | |||
| ) |
general function for POST (create) API calls
| string | $url | - URL pattern string with parameters in {} |
| array | $URLparams | - URL parameters |
| array | $QSparams | - query string parameters |
| DomDocument | $body | - object to add to Alma |
Definition at line 174 of file grima-lib.php.
Referenced by createSetFromImport(), postBib(), postElectronicPortfolio(), postElectronicPortfolioOnBib(), postHolding(), and postItem().
| Grima::postBib | ( | $bib | ) |
Create Record - adds a new bib record to Alma.
Makes a call to the API: (API docs)
POST /almaws/v1/bibs https://developers.exlibrisgroup.com/alma/apis/bibs#Resources
| DomDocument | $bib | Bib object to add to Alma as new record |
Definition at line 352 of file grima-lib.php.
References checkForErrorMessage(), and post().
| Grima::postElectronicPortfolio | ( | $collection_id, | |
| $service_id, | |||
| $portfolio | |||
| ) |
Create Electronic Portfolio - add a new portfolio to Alma.
Makes a call to the API: (API docs)
POST /almaws/v1/electronic/e-collections/{collection_id}/e-services/{service_id}/portfolios/
| string | $collection_id | ID of collection |
| string | $service_id | ID of service |
| string | $portfolio | A portfolio object to add to Alma |
Definition at line 778 of file grima-lib.php.
References checkForErrorMessage(), and post().
| Grima::postElectronicPortfolioOnBib | ( | $mms_id, | |
| $portfolio | |||
| ) |
Create Electronic Portfolio - add a new portfolio to Alma Bib.
Makes a call to the API: (API docs)
POST /almaws/v1/bibs/{mms_id}/portfolios/
| string | $portfolio_id | ID of portfolio |
Definition at line 801 of file grima-lib.php.
References checkForErrorMessage(), and post().
| Grima::postHolding | ( | $mms_id, | |
| $holding | |||
| ) |
Create holding record - add a new holdings record to a bib.
Makes a call to the API: (API docs)
POST /almaws/v1/bibs/{mms_id}/holdings
| string | $mms_id | MMS ID of bib record |
| DomDocument | $holding | Holding object to add to Alma as new record |
Definition at line 484 of file grima-lib.php.
References checkForErrorMessage(), and post().
| Grima::postItem | ( | $mms_id, | |
| $holding_id, | |||
| $item | |||
| ) |
Create Item - add a new item to a holding in Alma.
Makes a call to the API: (API docs)
POST /almaws/v1/bibs/{mms_id}/holdings/{holding_id}/items
| string | $mms_id | - MMS ID of Bib record |
| string | $holding_id | - Holding ID of Holding record |
| DomDocument | $item | - Item object to add to Alma as new record |
Definition at line 644 of file grima-lib.php.
References checkForErrorMessage(), and post().
| Grima::put | ( | $url, | |
| $URLparams, | |||
| $QSparams, | |||
| $body | |||
| ) |
general function for PUT (update) API calls
| string | $url | - URL pattern string with parameters in {} |
| array | $URLparams | - URL parameters |
| array | $QSparams | - query string parameters |
| DomDocument | $body | - record to update Alma record with |
Definition at line 218 of file grima-lib.php.
Referenced by putBib(), putElectronicPortfolioOnBib(), putHolding(), and putItem().
| Grima::putBib | ( | $mms_id, | |
| $bib | |||
| ) |
Update Bib Record - updates the copy of the bib in Alma.
Makes a call to the API: (API docs)
PUT /almaws/v1/bibs/{mms_id}
Definition at line 376 of file grima-lib.php.
References checkForErrorMessage(), and put().
| Grima::putElectronicPortfolioOnBib | ( | $mms_id, | |
| $portfolio_id, | |||
| $portfolio | |||
| ) |
Update Electronic Portfolio - update portfolio in Alma.
Makes a call to the API: (API docs)
PUT /almaws/v1/bibs/{mms_id}/portfolios/{portfolio_id}
| string | $mms_id | ID of bibliographic record |
| string | $portfolio_id | ID of portfolio |
Definition at line 825 of file grima-lib.php.
References checkForErrorMessage(), and put().
| Grima::putHolding | ( | $mms_id, | |
| $holding_id, | |||
| $holding | |||
| ) |
Update Holdings Record - replace the holdings record in Alma.
Makes a call to the API: (API docs)
PUT /almaws/v1/bibs/{mms_id}/holdings/{holding_id}
| string | $mms_id | MMS ID of Bib |
| string | $holding_id | Holding ID of holding to replace |
| DomDocument | $holding | Holding object to add to Alma as new record |
Definition at line 509 of file grima-lib.php.
References put().
| Grima::putItem | ( | $mms_id, | |
| $holding_id, | |||
| $item_pid, | |||
| $item | |||
| ) |
Update Item information - replace item record in Alma.
Makes a call to the API: (API docs)
PUT /almaws/v1/bibs/{mms_id}/holdings/{holding_id}/items/{item_pid}
| string | $mms_id | MMS ID of Bib record |
| string | $holding_id | Holding ID of Holding record |
| string | $item_pid | Item ID of Item record |
| DomDocument | $item | Item object to update record with in Alma |
Definition at line 670 of file grima-lib.php.
References put().
| Grima::session_destroy | ( | ) |
| Grima::session_init | ( | $force = false | ) |
Definition at line 20 of file grima-lib.php.
References join_paths().
Referenced by get_config(), session_destroy(), and session_save().
| Grima::session_save | ( | $result | ) |
| Grima::$apikey |
Definition at line 16 of file grima-lib.php.
| Grima::$server |
Definition at line 15 of file grima-lib.php.
1.8.14