EPrints Technical Mailing List Archive

Message: #07484


< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

[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