Ready to Learn?Ex Libris products all provide open APIs

  • Primo resources
  • Alma resources
  • Rosetta resources
  • Leganto resources
  • bX resources
  • SFX resources
  • Aleph resources
  • Voyager resources

Tech Blog

 

Using Alma APIs for creating Sets

Overview

 
On top of the Job APIs, it is now possible to use APIs to create a set which will be used as an input for the Job.
The page 'Managing Search Queries and Sets' which can be found here explains in details about all types of sets and their intended usage.
The various Set related API can be found here.
Note that an 'Update Set' API doesn't exist as this isn't a common use case. However you can always use the DELETE and POST to create a new set if needed.
 

Set types

There are two kinds of sets: 
Itemized - Individual items, selected or uploaded by the librarian
Logical - A saved search query, which is run every time the set is referenced.
It is possible to use APIs to either create an empty Itemized set and then populate with members, or create a logical set.
Logical set is currently supported for all Inventory sets (Bibs, Items, Portfolios, Digital representations etc.) but not for Users, PO-Lines and Vendors.
Logical set creation
The syntax for defining a logical set is similar to what appears in the UI when performing an Inventory search.
Current Search:  

Physical Items where Title (Title contains keywords "history") and Holding (Library (Holding) equals "Art Library") and Physical item (Receiving date after "2016-04-02")
 
However to see the exact syntax which is needed for creating a set using the API, it is recommended to first create a set using the UI, use a GET call to the API to find out what the syntax is, and then use it as a template for creating other similar Logical sets using the API. 
 
In the below sample you can see how a set of Items is defined by a 3 conditions: one from the Bib, one from the Holding and one from the Item. Note that the textual syntax which appears in the UI is included in the 'desc' attribute. As in all our APIs the 'desc' attributes are ignore when received in POST requests. The actual value of the 'query' field will be used. It uses a more technical syntax and the name are more code-like, but comparing to the 'desc' attribute should make it understandable.
<set link="/almaws/v1/conf/sets/1622034000000121">

    <id>1622034000000121</id>

    <name>items - history, Art, date</name>

    <type desc="Logical">LOGICAL</type>

    <content desc="Physical items">ITEM</content>

    <private desc="Yes">true</private>

    <status desc="Active">ACTIVE</status>

    <status_date>2017-02-22T10:35:41.664Z</status_date>

    <created_by desc="John Smith">johns</created_by>

    <created_date>2017-02-22T10:35:41.664Z</created_date>

    <query

        desc="Physical Items where Title (Title contains keywords "history") 

        and Holding (Library (Holding) equals "Art Library") 

        and Physical item (Receiving date after "2016-04-02")">

        ITEM where BIB_MMS (title CONTAIN "history")

        AND HOLDING (holding_Library OUTER_EQUAL "ART") 

        AND ITEM (arrivalDate AFTER "2016-04-02")</query>

    <number_of_members link="/almaws/v1/conf/sets/1622034000000121/members">3</number_of_members>

</set>
In the near future we'll be adding a special documentation page here at the Developer Network, which will list the available indexes for each inventory type. Hopefully this will enable creating a complex logical set, without creating a template one with the UI first.
 

Special use cases

 
If you would like to have a 'frozen' Itemized set from a Logical set you can use the Create Set API with the from_logical_set parameter. The payload could be as small as <set></set> since all fields have default values (or values which are taken from the logical set on which the new set is built). The original logical set remains as is.
 
It is also possible to create Logical sets based on the report of an MD-Import run. For this we have dedicated a separate blog post - see here