How to run an import profile via an API in 5 easy steps
In this blog post we will run an import profile to import records into Alma using an API.
Note that in order to retrieve profile IDs and Jobs IDs and run jobs you will need an API key for read write in the configuration area.
Get the import profile ID by retrieving (API GET) all import profiles of type repository and take the profile ID from the profile you want to use.
Here is the syntax (of course replace “01234567890” with your real API key) for GET to retrieve all import profiles of type repository:
For example we will use import profile ID 5181927070000121 which is for profile name Alma University MARC XML no inventory.
By the way it is also possible see the import profile ID in the user interface
Now we need to use the above import profile (5181927070000121) to get the job ID to run the import profile.
In other words: In order to now run the above import profile via an API we need to know what is the job ID that is used to run the import profile which has import profile ID 5181927070000121.
In order to get the job ID we need to run the GET jobs API and retrieve the job ID for import profile ID 5181927070000121.
Here is the syntax (note the inclusion of the import profile ID):
It returns the job ID. We see from the screenshot below that the job ID is S5978982000000121
Now run the job. In order to run the job with the import profile we run a POST as follows (note the inclusion of the job ID):
We use an empty job input as follows:
Then the result has an indication of when the job ran and a link to check the status of the job. Below the indication that the bjob rab is in the red square. The link to the status of the job is in the blue square (both in the additional_info section).
Use an API to see what happened (check the status of the job). We will use the link from the additional_info output above:
<additional_info link="https://api-eu.hosted.exlibrisgroup.com/almaws/v1/conf/jobs/S5978982000000121/instances/5978982020000121">Job no. 5978982020000121 triggered on Tue, 03 Sep 2019 07:53:10 GMT</additional_info>
and we will add the api_key to the end and do a GET:
The results is like looking at the job report. here is the beginning of the results:
If desired you can also see via the user interface that the import job ran via the API