How to create a bibliographic record based on an existing record in your insitution via an API in 5 easy steps.
This blog will focus on creating a bibliographic record based on an existing bibliographic record your institution.
The developer network already discusses how to create a bibliographic record using an API. See for example Create Record
However, this blog focuses on an existing record in institution and not a generic sample, so that you will have an example with, for example, other similar fields which you want to create. This existing record can therefore be used as a template for the new record.
Identify a bibliographic record which you want to use as a basis (template) for the new bibliographic record.
Be sure to use sandbox or production depending on API key you will use.
In the example here we will use MMSID 99188511200121 “The private life of Chariman Mao”
Do a GET on the bibliographic record and save the XML in a local file for editing.
Here is the syntax (of course replace “01234567890” with your real API key):
Edit the output from the GET above as follows to use as input for the POST to create the new bibliographic record.
Remove these first two lines (so that the first line of the new input will begin with “<bib>”):
<?xml version=”1.0″ encoding=”UTF-8″ standalone=”yes”?>
Remove this last line (so that the last line of the input will be “</bib>”):
Remove all lines between and including these two lines
Now the first two lines are this:
The last two lines are this:
Note that if <suppress_from_publishing> is not present in the input then the default will be “true”.
If you want the suppress_from_publishing to be false then add this line after the first line:
Here is the beginning of our input:
<bib> <suppress_from_publishing>false</suppress_from_publishing> <record> <leader>05691cam a2200781 a 4500</leader> <controlfield tag="008">940712s1994 nyuabf b 001 0beng </controlfield> <datafield ind1="0" ind2="0" tag="082"> <subfield code="a">613.248</subfield> <subfield code="2">20</subfield> </datafield> <datafield ind1="1" ind2=" " tag="100"> <subfield code="a">Smith, Harry</subfield> </datafield> <datafield ind1="1" ind2="4" tag="245"> <subfield code="a">The private life of Jimmy Smith</subfield> </datafield>
Do a POST as follows:
In the Body choose application/xml and put in the edited output from the GET above.
Get response with MMSID
See record in Alma and see that it was created from the API