Tech Blog

Performing the Alma “scan-in” API on a file of barcodes

The Alma scan-in API is useful in order to put items back in place by the end of the day.
The following script can be used in order to perform a “bulk” scan-in on a list of barcodes in a single file.
As you can see in the below script, the scan-in API is working on item pid. So we first need to get this information based on the barcode, and only after this perform the scan-in operation.

set library   = LIBCODE
set circ_desk = CIRCDESKCODE

set prefix = 'https://api-na.hosted.exlibrisgroup.com/'
set api_key_header = 'Authorization: apikey XXXXX'


foreach barc (`cat scan_in_barcodes.txt`)
  echo __ processing barcode $barc __
  set item_by_barc_url = $prefix'almaws/v1/items?item_barcode='$barc
  echo __ Calling GET "$item_by_barc_url" ...
  curl --dump-header /tmp/item.$barc.tmp "$item_by_barc_url" -H "$api_key_header"
  set item_url = "`cat /tmp/item.$barc.tmp | grep Location | sed 's/.*almaws/almaws/' | sed 's/\r//g'`"
  set scan_in_url = $prefix"$item_url"'&op=scan&library='$library'&circ_desk='$circ_desk''
  echo __ Calling POST "$scan_in_url" ...
  curl -X POST "$scan_in_url" -H 'Content-Type: application/xml'
  echo
end

 

5 Replies to “Performing the Alma “scan-in” API on a file of barcodes”

  1. Very useful. Is there documentation about this? Everything I found working with items requires knowing the mms_id and holding_id

    By Kyle Banerjee on May 19, 2016 at 11:48 PM

  2. I haven’t been able to find anything in the API documentation about the ‘items redirect’ that is essential to this application. It was described in a post to the Alma forum in June 2014:

    Yes, there is:
    /almaws/v1/items?item_barcode={item_barcode}
    redirects to:
    /almaws/v1/bibs/{mms_id}/holdings/{holding_id}/items/{item_pid}
    Hope this helps,
    Ori
    Alma API Team

    … but it took me a while to find it. Here’s a link:

    https://developers.exlibrisgroup.com/discussions#!/forum/posts/list/45.page

    Erik Biever
    University of Minnesota Libraries
    By Erik Biever on May 20, 2016 at 5:59 PM

  3. Thanks to my colleague, Jeff Peterson, for pointing out that the redirect is mentioned in the documentation for the ‘Retrieve Item and label printing information” web service:

    Ex Libris Developer Network /Alma /APIs /Bibs /Retrieve Item and label printing information

    I wouldn’t have thought to look for it there.

    — Erik

    By Erik Biever on May 20, 2016 at 7:43 PM

  4. It appears the the undocumented /items API endpoint no longer works. Anybody know of a workaround to look up an item by its barcode?

    By Mark McCann on November 8, 2017 at 8:31 PM

  5. Ok. My bad. This undocumented API endpoint still works. Would be great if this (and others like it) were added to the API documentation.

    By Mark McCann on November 8, 2017 at 8:58 PM

Leave a Reply