Add summary holding statement by using holdings API
If you don’t like the holdings statement derived from the items, and there is no any 866 fields in your holding records, you can use this code to get holding records from ALMA. Then you use this code to add 866 fields to holding records, and put/update them back to ALMA. Attention: if your holding records already have 866 field, this code does not fit you.
The first step is to create a holding PID list file. The file should be in text format and contain all holding PIDs line by line.
The second step is to get holding records.
The code from Get_holding_records.php will read all holding PIDs from a PID list text file and put them into an array. Then, it uses ALMA holding “get” API to get holding records one by one and save them into a text file. The records are in XML format which is shown as below.
The third step is to create a list file which has the PIDs and related holding statements matched. The PID and holding statement should be separated by a vertical line. The format is shown as below. We use vlookup function in Google spreadsheet and some tricky way to create this file.
The 4th step is to use the code from Update_holding_records.php to read holding records obtained by 2nd step, and inject summary holding statements into each holding records, then put/update them back to ALMA.
The code is written by PHP, and passed in windows 7 + PHP 5.6.26. We benefit a lot from the blog “Calling Alma APIs using PHP” written by Ori Miller, and appreciate it very much.
We get/pull about 2,000 holding records at about 20 minutes, very fast. We put/update these holding records back to ALMA at about 1 hour.
Two PHP files are used which are located in git https://github.com/andytang2008/Holding_record_manipulation
Attention: this php code can only run in once. If you run 2nd time, you may create duplicated 866 field. So, be careful.