<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"Segoe UI";
        panose-1:2 11 5 2 4 2 4 2 2 3;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;
        mso-believe-normal-left:yes;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.groupwisereplyheader
        {mso-style-name:groupwisereplyheader;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Courier New";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><![if mso 9]><style>p.MsoNormal
        {margin-left:12.0pt;}
</style><![endif]><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="blue" vlink="purple" style="margin-left:12.0pt;margin-top:12.0pt;margin-right:12.0pt;margin-bottom:3.0pt">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">At the risk of treading on Adam’s toes…<o:p></o:p></span></p>
<pre><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">If you try one of the exports on the search results page it gives you the detail you are after (plus a load of stuff you aren’t) e.g. the url below is for the JSON export of that search: <o:p></o:p></span></pre>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><a href="http://researchonline.lshtm.ac.uk/cgi/search/archive/advanced/export_lshtm_JSON.js?screen=Search&dataset=archive&_action_export=1&output=JSON&exp=0%7C0%7C-date%2Fcreators_name%2Ftitle%7Carchive%7C-%7Clshtm_pub_id%3Alshtm_pub_id%3AALL%3AIN%3A26205126%7C-%7Ceprint_status%3Aeprint_status%3AANY%3AEQ%3Aarchive%7Cmetadata_visibility%3Ametadata_visibility%3AANY%3AEQ%3Ashow&n=&cache=402040">http://researchonline.lshtm.ac.uk/cgi/search/archive/advanced/export_lshtm_JSON.js?screen=Search&dataset=archive&_action_export=1&output=JSON&exp=0%7C0%7C-date%2Fcreators_name%2Ftitle%7Carchive%7C-%7Clshtm_pub_id%3Alshtm_pub_id%3AALL%3AIN%3A26205126%7C-%7Ceprint_status%3Aeprint_status%3AANY%3AEQ%3Aarchive%7Cmetadata_visibility%3Ametadata_visibility%3AANY%3AEQ%3Ashow&n=&cache=402040</a><o:p></o:p></span></p>
<pre><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">which includes the lines<o:p></o:p></span></pre>
<pre><span style="color:black">[<o:p></o:p></span></pre>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt"><span style="font-size:10.0pt;font-family:"Courier New";color:black"> {<o:p></o:p></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt"><span style="font-size:10.0pt;font-family:"Courier New";color:black"> "view_date": 2015,<o:p></o:p></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt"><span style="font-size:10.0pt;font-family:"Courier New";color:black"> "eprintid": 2287468,<o:p></o:p></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt"><span style="font-size:10.0pt;font-family:"Courier New";color:black"> "date": 2015,<o:p></o:p></span></p>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt"><span style="font-size:10.0pt;font-family:"Courier New";color:black"> …<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">So you could use one of the existing exporter URLs and take the information you want, or possibly write an exporter to just return
the eprintid in an appropriate format? (I believe there are some excellent videos on how to do that sort of thing on the eprints wiki…)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">Cheers,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">Alan<o:p></o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt"><b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif"> eprints-tech-bounces@ecs.soton.ac.uk
[mailto:eprints-tech-bounces@ecs.soton.ac.uk] <b>On Behalf Of </b>Andy Reid<br>
<b>Sent:</b> 24 September 2015 11:43<br>
<b>To:</b> eprints-tech@ecs.soton.ac.uk<br>
<b>Subject:</b> [EP-tech] Re: cgi/search?myfield=foobar&action=export&format=xml (or whatever the syntax...)<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div id="GroupWiseSection_1443088918000_Andy.Reid@lshtm.ac.uk_E7E91160180E0000BAA6000000100002_">
<div>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt"><span style="font-size:10.0pt;font-family:"Segoe UI",sans-serif">Thanks Adam,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt"><span style="font-size:10.0pt;font-family:"Segoe UI",sans-serif">The situation is that our publications are initially imported to a local Publications database, which has an API to generate EPXML,
which is then pulled into eprints by a fiendish Harvester maintained by Rory over at ULCC, where the repository is hosted. The record structure in eprints includes a custom field - lshtm_pub_id - recording the recordID of the source record in the publications
database, but because the synchronisation is pulled from the eprints end, the DB never gets to find out what the resulting eprint ID is. In order to link through from the pubsDB to eprints, we have a link that searches on the lshtm_pub_id , e.g.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt"><span style="font-size:10.0pt;font-family:"Segoe UI",sans-serif"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt"><span style="font-size:10.0pt;font-family:"Segoe UI",sans-serif"><a href="http://www.lshtm.ac.uk/publications/list.php?filter=list&value=(26205126">http://www.lshtm.ac.uk/publications/list.php?filter=list&value=(26205126)</a>
the link to ResearchOnline gives something like this (I've stripped out the PMID search elements below for clarity) - I'm not sure that all those parameters are necessary, but it works:<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt"><span style="font-size:10.0pt;font-family:"Segoe UI",sans-serif"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt"><span style="font-size:10.0pt;font-family:"Segoe UI",sans-serif"><a href="http://researchonline.lshtm.ac.uk/cgi/search/advanced?screen=Public%3A%3AEPrintSearch&lshtm_pub_id_merge=ALL&lshtm_pub_id=26205126&satisfyall=ANY&order=-date%2Fcreators_name%2Ftitle&_action_search=Search">http://researchonline.lshtm.ac.uk/cgi/search/advanced?screen=Public%3A%3AEPrintSearch&lshtm_pub_id_merge=ALL&lshtm_pub_id=26205126&satisfyall=ANY&order=-date%2Fcreators_name%2Ftitle&_action_search=Search</a><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt"><span style="font-size:10.0pt;font-family:"Segoe UI",sans-serif"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt"><span style="font-size:10.0pt;font-family:"Segoe UI",sans-serif">What I'm after is just to use that search in a programmatic context, so that it just returns the matching eprint ID(s), rather than
the whole page. I'm sure it's simple when you know how, but the inline documentation of the cgi script is...
<em><span style="font-family:"Segoe UI",sans-serif">terse,</span></em> to put it politely - Even a one line #Usage:.. example would probably make all the difference. <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt"><span style="font-size:10.0pt;font-family:"Segoe UI",sans-serif"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt"><span style="font-size:10.0pt;font-family:"Segoe UI",sans-serif">Best Regards<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt"><span style="font-size:10.0pt;font-family:"Segoe UI",sans-serif"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt"><span style="font-size:10.0pt;font-family:"Segoe UI",sans-serif">Andy<o:p></o:p></span></p>
</div>
<div id="GroupWiseSection_1443088400000_af05v@ecs.soton.ac.uk">
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt"><span class="groupwisereplyheader"><span style="font-size:10.0pt;font-family:"Segoe UI",sans-serif">>>> "Field A.N." <<a href="mailto:af05v@ecs.soton.ac.uk">af05v@ecs.soton.ac.uk</a>> 24 September
2015 10:53 >>></span></span><span style="font-size:10.0pt;font-family:"Segoe UI",sans-serif"><o:p></o:p></span></p>
<div>
<div>
<p class="MsoNormal" style="margin:0cm;margin-bottom:.0001pt"><span style="font-size:10.0pt;font-family:"Segoe UI",sans-serif"><br>
EPrints searches are all controlled by cgi parameters, including exporting, so if a configured search exists, then you are able to pull out XML data from it (as long as the XML exporter is enabled). If you send me your repository URL and an example of
a search you might want to run, I'll tell you how to build the query you're after.<br>
<br>
<br>
--<br>
Adam Field<br>
Business Relationship Manager and Community Lead<br>
EPrints Services<br>
+44 (0)23 8059 8814<br>
<br>
<br>
<br>
<br>
<br>
On 23 Sep 2015, at 18:33, Andy Reid wrote:<br>
<br>
> Hi,<br>
> I've searched around but can't find any basic documentation of the cgi/search function, and my mental perl interpreter is struggling with the source code.
<br>
> <br>
> Q: Is it possible with the CGI search interface to send a query string naming a field and a search term, and specify the return format as XML - either full XML for matching records(minus files), or a better still a list of eprint IDs that match the search?
It looks like it should be possible, but a simple example would be a whole lot easier than reverse-engineering the whole search script in my head.
<br>
> <br>
> Thanks in anticipation<br>
> <br>
> Andy<br>
> <br>
> Andy Reid<br>
> Research Information Manager<br>
> Room G43, Executive Office<br>
> London School of Hygiene & Tropical Medicine<br>
> Keppel St<br>
> LONDON WC1E 7HT<br>
> +44 020-7927-2618<br>
> <a href="http://orcid.org/0000-0002-2500-2980">http://orcid.org/0000-0002-2500-2980</a><br>
> <br>
> *** Options: <a href="http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech">
http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech</a><br>
> *** Archive: <a href="http://www.eprints.org/tech.php/">http://www.eprints.org/tech.php/</a><br>
> *** EPrints community wiki: <a href="http://wiki.eprints.org/">http://wiki.eprints.org/</a><br>
> *** EPrints developers Forum: <a href="http://forum.eprints.org/">http://forum.eprints.org/</a><br>
<br>
<br>
*** Options: <a href="http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech">
http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech</a><br>
*** Archive: <a href="http://www.eprints.org/tech.php/">http://www.eprints.org/tech.php/</a><br>
*** EPrints community wiki: <a href="http://wiki.eprints.org/">http://wiki.eprints.org/</a><br>
*** EPrints developers Forum: <a href="http://forum.eprints.org/">http://forum.eprints.org/</a><o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</div>
-- 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.
</body>
</html>