Improve OpenURL generation to remove blanks and duplicates
Openurls generated could by Alma/Primo be shorted by:
- Not sending duplicate parameters.
- Not sending empty parameters.
Background:
We have noticed that OpenURLs produced by Alma/Primo (which are then sent on to our ILLiad server, which can require redirection to get the patron authenticated) can be VERY long. So long in fact, that they can produce errors for our ILLiad web server. The ILLiad server will end up reporting "Request header is too large", and the user is left with a HTTP Status 400 Bad request error.
We believe the responsibility here is on the Alma/PRimo side as the urls generated could be shorted by:
- Not sending duplicate parameters.
- Not sending empty parameters.
Note: For our (UW-Madison's) locally developed discovery interface, we generate our own OpenURL links for things like "Request a copy" from article searching and the catalog records, so we can ensure proper length limits.
ExLibris generates OpenURL links in their UResolver (Find it) and Primo Search API
Alma/Primo OpenURLs
For example, following a "Find it at UW-Madison" link from Google Scholar and then doing "Request a copy" (sending the OpenURL on to our ILLiad server):
Starting in Google Sholar, and ending up here:
https://uwi-primoalma-prod.hosted.exlibrisgroup.com/primo-explore/openurl?sid=google&auinit=PM&aulast=Vitousek&atitle=Beyond%20global%20warming:%20ecology%20and%20global%20change&id=doi:10.2307%2F1941591&title=Ecology.&volume=75&issue=7&date=1994&spage=1861&issn=0012-9658&vid=WISC&institution=WISC&url_ctx_val=&url_ctx_fmt=null&isSerivcesPage=true
Provides an OpenURL link (request a copy) of:
Where the following parameters are included, yet blank:
au, month, number, epage, edition, aufirst, pubyear
Primo Search API
In order to display electronic availability for articles we have to query the OpenURL resolver in alma to get data back. The string we use to query the resolver is provided to us by the Primo Search API
Primo API Docs - Ex Libris Developer Network
This one is by far the biggest offender, as that API returns the "GetIt1" URL we need to use. An example URL returned to us looks like:
Previously we ran this URL through a parser to validate it and then remove empty parameters. There are three issues with this data - 1) sometimes keys are duplicated, which goes against best practices 2) Data is not properly url encoded 3) There are a lot of empty parameters.
Removing those parameters for this example request would drop the length of the URL from 1328 to 1052 characters
Note: We no longer parse this data as it was dropping the duplicated parameters causing lookup issues, so it's passed through to our OpenURL resolver as we receive it from the API (aside from prepending a parameter to return XML instead of HTML)
-
Curran Riley commented
FYI, As the person who posted this, https://ideas.exlibrisgroup.com/forums/308173-alma/suggestions/18679072-allow-same-url-functions-rules-possible-for-dynami may be the better idea to vote for.
Ex Libris has pointed out that we have control over these templates. We feel we can't omit items to shorten it, but having conditional logic as mentioned in the other idea would allow us to keep what we need while removing empty/blank values