Print

Print


Just a follow-up from a few weeks ago regarding searching and requesting through the Alma/Primo API.

Thank you to Jonathan Rochkind, Brian Meuse, Tom Hutchinson, Kate Deibel, and Chad Nelson for your help.

I thought I'd report back on my progress.

It was the case that we needed to put in a support ticket to Ex Libris to turn on the Primo API.

We all know that requesting a book is a several step process, and I boiled it down to 6 API calls from start to finish (some with user interaction in between)

1. Search Query:
GET https://api-na.hosted.exlibrisgroup.com/primo/v1/pnxs?q=title,contains,flopsy bunnies&lang=eng&offset=1&limit=10&view=full&vid=STTHOMAS&scope=stthomas&apikey={{apikey}}

2. After user makes selection: Get BIB
GET https://api-na.hosted.exlibrisgroup.com/almaws/v1/bibs/?view=full&expand=p_avail,e_avail,d_avail &nz_mms_id={{mms_id}}&format=json&apikey={{apikey}}

3. Get Holding Link
GET https://api-na.hosted.exlibrisgroup.com/almaws/v1/bibs/{{mms_id}}/holdings?format=json&apikey={{apikey}}

4. Get PID
GET https://api-na.hosted.exlibrisgroup.com/almaws/v1/bibs/{{mms_id}}/holdings/{{holding_id}}/items/?format=json&apikey={{apikey}}

5. Get User info (after auth, of course!):
GET https://api-na.hosted.exlibrisgroup.com/almaws/v1/users/{{user_id}}?user_id_type=all_unique&view=full&expand=none&apikey={{apikey}}&format=json

6. Perform request by sending a request object
POST https://api-na.hosted.exlibrisgroup.com/almaws/v1/bibs/{{mms_id}}/holdings/{{holding_id}}/items/{{item_pid}}/requests?user_id={{user_id}}&format=json&apikey={{apikey}} (and send along a request object in the body)

Of course this only deals with local holdings. We are in a consortium and I have barely scratched the surface on making a resource sharing request.

-Chad
Chad Kluck
Web Developer
University of St. Thomas Libraries 
[log in to unmask]
(651) 962-5416
University of St. Thomas | stthomas.edu 

-----Original Message-----
From: Code for Libraries [mailto:[log in to unmask]] On Behalf Of Chad Nelson
Sent: Monday, December 18, 2017 11:13 AM
To: [log in to unmask]
Subject: Re: [CODE4LIB] Experience with Primo API

HI Chad,

At Temple we have started work on a Ruby client for the Primo PNX api -
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ftulibraries%2Fprimo&data=02%7C01%7Cclkluck%40STTHOMAS.EDU%7C701882f69211469d422308d5463abdc0%7Ca081ff79318c45ec95f338ebc2801472%7C1%7C0%7C636492140470303661&sdata=tSllFSfZxBSxDILro9jdVxJbTRPOLUQpXjEG1qZP1Us%3D&reserved=0 . It's still a work in progress, but will do a basic search.

We only launched with Primo earlier this year, but they encouraged us to only use the PNX  REST api, and to not use the X-Services. We've found the Primo PNX api to be a bit slow in producion, and REALLLLLY slow coming from the sandbox.

One thing I would note about your API url is that you appear to be using the European servers, "api-eu" but you will need to be using the North American servers, api-na, or else your API key won't work as expected.
Maybe you've already sussed that, but that threw me for a loop when we first started using it.

Good luck :) ,

Chad Nelson
Temple University Libraries


On Fri, Dec 15, 2017 at 10:51 PM Kluck, Chad L. <[log in to unmask]>
wrote:

> We're wondering if anyone has experience, and documentation, with the 
> Primo API. We have so far developed with the Alma API and other APIs 
> so I'm not asking about API GET/POST/PUT requests or CURL. However, 
> since the Primo API for some of the search is listed as "Under 
> Construction" it is harder to work our way around what we should expect for received data.
>
>
> We submitted a support case for some help from Ex Libris, but if 
> anyone has a repository, or some docs that would help. We're basically 
> trying to do regular search queries, like feed 
> q=any,contains,immortality%20kundera
> (see below)
>
>
> We saw in the Code4Lib archive that the Primo API was IP restricted 
> back in 2014, but was wondering if that is still the case.
>
>
> Submitted to Ex Libris Sales Force
>
> Case Title: API for Primo - known item searches
> Description:
> We need help getting a functioning query with the Primo API. Our use 
> case is that we are working with a company to develop a chatbot which 
> can take a natural language query, get a list of results from Primo 
> via API (using author or title search), and check our holdings and 
> availability and let the user know if it is available and make a 
> request. The second part seems to be accomplished via the Bibs API, 
> but getting the MMS IDs of a set of results from a Primo search seems 
> to require the Primo API. We have not been able to get results from our test queries.
>
> We have the API key set up for our API application StthomasAI with 
> permissions to use the Primo Search (under const.) API. We have tried 
> using both Brief Search and Delivery Service Search but are not having luck.
>
> For example:
>
> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapi-e
> u.hosted.exlibrisgroup.com%2Fprimo%2Fv1%2Fsearch%3Fvid%3DSTTHOMAS%26ta
> b%3Ddefault_tab%26scope%3Dstthomas%26q%3Dany%252Ccontains%252Cimmortal
> ity%2520kundera%26lang%3Deng%26offset%3D0%26limit%3D10%26sort%3Drank%2
> 6pcAvailability%3Dtrue%26conVoc%3Dtrue%26apikey%3D%5B*************&dat
> a=02%7C01%7Cclkluck%40STTHOMAS.EDU%7C701882f69211469d422308d5463abdc0%
> 7Ca081ff79318c45ec95f338ebc2801472%7C1%7C0%7C636492140470303661&sdata=
> %2FAA65TcX1NPER5zbRpCLa%2FxA7BkzxODqKoVyYBAT0k4%3D&reserved=0]
>
>
> Thanks!<
> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapi-e
> u.hosted.exlibrisgroup.com%2Fprimo%2Fv1%2Fsearch%3Fvid%3DSTTHOMAS%26ta
> b%3Ddefault_tab%26scope%3Dstthomas%26q%3Dany%252Ccontains%252Cimmortal
> ity%2520kundera%26lang%3Deng%26offset%3D0%26limit%3D10%26sort%3Drank%2
> 6pcAvailability%3Dtrue%26conVoc%3Dtrue%26apikey%3Dl7xx95e1392be88248b4
> 938710ae279a414d&data=02%7C01%7Cclkluck%40stthomas.edu%7C515ce934bafa4
> 0bfbef608d543104819%7Ca081ff79318c45ec95f338ebc2801472%7C1%7C0%7C63648
> 8659564215396&sdata=9hPnbkelNXwLgH7ASASrCbItNzWx%2F2cK3Hml0J9LjwI%3D&r
> eserved=0
> >
>
>
> -Chad
>
> Chad L. Kluck
> Web Developer
> University of St. Thomas Libraries
> (651) 962-5416
>
> Sent from Outlook Web Access
> [University of St. Thomas : All for the Common Good]< 
> http://www.stthomas.edu/e>
>