Forum - Create Item API removing Alma Generated Barcode

  • This topic has 5 replies, 2 voices, and was last updated 1 week, 4 days ago by Tami Fuches.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #66292
    Raymond Deiser
    Participant

    With the help of Kathryn Lybarger’s Grima (https://github.com/zemkat/grima), I have created a way to batch create Item Records based on a list of Holding Id numbers. Everything works great except that the API is removing the Alma Generated Barcode even though it is not set up to modify the barcode:

    <?php

    require_once(“../grima-lib.php”);

    class BatchItems extends GrimaTask {
    public $holdinglist = array();

    function do_task() {
    $this->holdings = preg_split(‘/\r\n|\r|\n/’,$this[‘holding_id’]);

    foreach ($this->holdings as $holdingid) {
    $holding = new Holding();
    $this[‘mms_id’] = Holding::getMmsFromHoldingID($holdingid);
    if ($this[‘mms_id’]) {
    $holding->loadFromAlma($this[‘mms_id’],$holdingid);
    $item = new Item();
    //$item[‘inventory_date’] = ‘1976-01-01’;
    $item[‘statistics_note_2’] = ‘FIRE 2018 OZONE’;
    $item[‘statistics_note_3’] = $this[‘whichnote’];
    $item->addToAlmaHolding($this[‘mms_id’],$holdingid);
    $this->addMessage(‘success’,”Successfully added an Item Record to {$holdingid} with item PID: {$item[‘item_pid’]}”);
    } else {
    $this->addMessage(‘error’,”Holding Record Suppressed or no longer active in Alma {$holdingid}”);
    }
    $this->holdinglist[] = $holding;
    }
    }
    }
    BatchItems::RunIt();

    The following is from the Item Record History tab from an Item Record that was created with the API:
    Date Operator Field Name Old Value New Value
    05/13/2020 10:48:24 exl_api Barcode HaleFire-000005
    05/13/2020 10:48:24 exl_api Is Magnetic No
    05/13/2020 10:48:24 exl_api Statistics note 2 FIRE 2018 OZONE
    05/13/2020 10:48:24 exl_api Statistics note 3 ANNEX ingest

    Any help with this will be great. Thank you for your time.

    #66293
    Tami Fuches
    Moderator

    Hi Raymond,
    I am not sure that I understand…
    You have created a new item, right?
    Did you put a barcode value in the payload? was it created without it?

    I suggest to use the GET item API in order to see which value it has in the barcode (and not the history tab).

    Tamar
    Alma API team

    #66300
    Raymond Deiser
    Participant

    Hiya Tamar,

    Yes, I have created a new item record with the API POST /almaws/v1/bibs/{mms_id}/holdings/{holding_id}/items. Within Alma I have the Barcode Generation Configuration set to create a barcode like the following: HaleFire-000000. I am not providing a barcode value within the payload because I want to utilize the generated barcode but the API is removing the generated barcode. From the example above, the HaleFire-000005 barcode is the Old Value. I would like to state that I am still new to programming, so I might be missing something obvious. Thank you for your time.

    Raymond

    #66304
    Tami Fuches
    Moderator

    So what do you mean by “HaleFire-000005 barcode is the Old Value”?
    The item is created without a barcode?

    Tamar

    #66361
    Raymond Deiser
    Participant

    Correct, the item record is created without a barcode. Once the API is finished creating the new item record, I open the item record in editing mode and the barcode field is not populated. I then click on the ‘history’ tab and it states that the API removed the Alma generated barcode.

    Yesterday I modified the Barcode Generation Configuration within Alma to be at the institution level instead of at the library level and tested the API. Now, after the API is ran the barcode field is populated with an Alma generated barcode. But when I open the item record in editing mode and click on the ‘history’ tab it shows the following:
    Date Operator Field Name Old Value New Value
    05/20/2020 10:00:44 exl_api Barcode HaleFire-000005 HaleFire-000006

    So, I am assuming it is an Alma issue that this is happening and I need to open a SalesForce case?

    Raymond

    #66363
    Tami Fuches
    Moderator

    Hi Raymond,
    Yes, please open a SF case.

    Tamar

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.