-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmmsid-pull.sh
40 lines (33 loc) · 924 Bytes
/
mmsid-pull.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
# catalog pulls using mmsid
function show_help() {
echo
echo -e "USAGE: mmsid-pull.sh -m <MMSID> "
echo -e "-m : mmsid e.g. alma991105954773306196"
echo -f "-f : set to receive full json record"
echo
exit 1
}
fulljson=false
# Parse arguments
while getopts "h?m:f" opt; do
case "$opt" in
h|\?)
show_help
;;
m) MMSID=$OPTARG
;;
f) fulljson=true
;;
esac
done
if [ -z "$MMSID" ]; then
echo "-m MMSID required"
exit 1
fi
if $fulljson; then
curl -s "https://librarysearch.library.utoronto.ca/primaws/rest/pub/pnxs/L/${MMSID}?vid=01UTORONTO_INST:UTORONTO&lang=en" 2>/dev/null
else
# curl command to get just get relevant catalog metadata
curl -s "https://librarysearch.library.utoronto.ca/primaws/rest/pub/pnxs/L/${MMSID}?vid=01UTORONTO_INST:UTORONTO&lang=en" | jq -r '.pnx | del(.delivery,.display.source,.display.crsinfo)'
fi