Tech Blog

How to create a logical set of bibliographic records via an API in 5 easy steps

Information regarding creating the set may be found on the developers network at “Documentation > Alma > REST APIs > Configuration and Administration > Create a Set”.

In the example here we will create (POST) a set by first retrieving (GET) an existing specific set and using the syntax of that set to create a new set.

  1. First we will retrieve (GET) a list of sets by word from name of set.
  2. From the results we will get the ID of a specific set.
  3. Then we will retrieve (GET) the specific set using the ID.
  4. From the results of the GET which used the specific set ID we will retrieve the XML of the set parameters.
  5. We will then edit this parameter to create (POST) a new set

ONE
To retrieve a set by name do a GET with this syntax, where the set name in this case is “Author Elia Zafrani” and API key is “01234567890” (change accordingly).

https://api-eu.hosted.exlibrisgroup.com/almaws/v1/conf/sets?q=name~Author_Elia_Zafrani&limit=10&offset=0&apikey=01234567890

If the set name to be retrieved is “Keywords Elia Zafrani” and API key is “01234567890” (change accordingly) use this syntax:

https://api-eu.hosted.exlibrisgroup.com/almaws/v1/conf/sets?q=name~Keywords_Elia_Zafrani&limit=10&offset=0&apikey=01234567890

To retrieve both of the above sets use this syntax, where anywhere in the name of the set will be “Elia Zafrani” and API key is “01234567890”. (Change accordingly).

https://api-eu.hosted.exlibrisgroup.com/almaws/v1/conf/sets?q=name~Elia_Zafrani&limit=10&offset=0&apikey=01234567890

TWO
The set ID appears in the results (and also appears in the Alma UI).

THREE
Now we will retrieve (GET) the specific set using the ID, and the results will include the syntax of how the set was created.
Later we will use this syntax to create a new set
If the set ID to be retrieved is 5828034310000121 and API key is “01234567890” (change accordingly) use this syntax:

https://api-eu.hosted.exlibrisgroup.com/almaws/v1/conf/sets/5828034310000121?apikey=01234567890

Get results including the syntax that was used to create the set.

FOUR
Change the resulting XML to use as input for the new set creation. Change it as follows:

Remove the lines with these values, because these values will be created automatically:

  • <ID>
  • <status_date>
  • <created_by>
  • <created_date>
  • <number_of_members>

Make these changes:

  • Change the line with <name> to have your new set name
  • Change the line with <query> to have your new query
  • Change the line with <set> to not have the link

Compare below the output from the GET and the input for the POST (where the inout for the POST creates a set named “Feminist Theiory” and searches keywords = Feminist Theory)

Output from GET

<set link="https://api-eu.hosted.exlibrisgroup.com/almaws/v1/conf/sets/5828034310000121">
<id>5828034310000121</id>
<name>Keywords Elia Zafrani</name>
<type desc="Logical">LOGICAL</type>
<content desc="All Titles">BIB_MMS</content>
<private desc="No">false</private>
<status desc="Active">ACTIVE</status>
<status_date>2019-06-17T04:49:38.694Z</status_date>
<created_by desc="Laura Jackson">LauraJ613</created_by>
<created_date>2019-06-17T04:49:38.694Z</created_date>
<query desc="All Titles where Title (Keywords contains keywords "Elia Zafrani")">BIB_MMS where BIB_MMS (all CONTAIN "Elia Zafrani")</query>
<number_of_members link="https://api-eu.hosted.exlibrisgroup.com/almaws/v1/conf/sets/5828034310000121/members">37</number_of_members>
</set>

Input for the POST

<set>
<name>Keywords Feminist Theory</name>
<type desc="Logical">LOGICAL</type>
<content desc="All Titles">BIB_MMS</content>
<private desc="No">false</private>
<status desc="Active">ACTIVE</status>
<query>BIB_MMS where BIB_MMS (all CONTAIN "Feminist Theory")</query>
</set>

FIVE
Create the new set by doing a POST with the following syntax (change API key to your real API key

https://api-eu.hosted.exlibrisgroup.com/almaws/v1/conf/sets?apikey=01234567890

The header content type will be application/xml
The representation with content-type application/xml will be the edited XML from the previous slide

You can see from the response that the set got created.

You can also see the set created in Alma and can see that it was created via the API

Leave a Reply