[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EP-tech] Custom lookup script using a REST-API



I think the issue might be as simple as the name of your script - try renaming it so it doesn't have the '.pl' on the end as the workflow reference doesn't have it.

Alan

From: eprints-tech-bounces at ecs.soton.ac.uk [mailto:eprints-tech-bounces at ecs.soton.ac.uk] On Behalf Of Stefan Wellsandt via Eprints-tech
Sent: 11 September 2018 08:38
To: eprints-tech at ecs.soton.ac.uk
Subject: [EP-tech] Custom lookup script using a REST-API

Hello,

I am a novice in PERL but I have to create a simple lookup script for our institute that provides an autocomplete list from a REST-API response. The latter is a JSON-formatted list of our research project names. We use ePrints 3.3. From the documentation and tutorial videos, I understood that I could create a custom lookup script for this purpose. My thoughts about the implementation were these:


1.       The script is in the new "projects_api.pl" file I place in the "archives/cgi/users/lookup" folder.

2.       It should provide an output in the format (value, tab, <li>) as described here: https://wiki.eprints.org/w/Autocompletion

3.       The "simple_file.pl" lookup file serves as the template for the custom lookup script: https://github.com/eprints/eprints/blob/3.3/cgi/users/lookup/simple_file

4.       I have to remove the part where it opens the file with my custom code. The latter turns the JSON response into an array of project names.

5.       I call the custom lookup script in the workflows/eprint/default.xml via:

<field ref="projects" input_lookup_url="{/archives/biba/cgi/users/lookup/projects_api"/>

My problem is that the call does not work in my test case. I can find a "404 File not Found - BIBA Repository" in the HTML source code, but I am stuck here, because I do not know where I have to search for the problem.

Can anyone help me out and indicate where the problem might be?

Best Regards
Stefan
-- The Open University is incorporated by Royal Charter (RC 000391), an exempt charity in England & Wales and a charity registered in Scotland (SC 038302). The Open University is authorised and regulated by the Financial Conduct Authority in relation to its secondary activity of credit broking.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20180911/81117e65/attachment-0001.html