EPrints Technical Mailing List Archive
See the EPrints wiki for instructions on how to join this mailing list and related information.
Message: #06595
< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First
Re: [EP-tech] Sword 2.0 access control
- To: "'eprints-tech@ecs.soton.ac.uk'" <eprints-tech@ecs.soton.ac.uk>
- Subject: Re: [EP-tech] Sword 2.0 access control
- From: Andy Reid <Andy.REID@lshtm.ac.uk>
- Date: Tue, 20 Jun 2017 16:45:21 +0000
Hi Andrew, I spent ages struggling with easyDeposit, then got it working in a day with CURL.
I have a separate staging system that brings together the metadata and the documents then generates ep-xml with embedded base64 files. Then this bit of PHP does the CURL and pushes it at the SWORD/CRUD api.
This is to create a new eprint. I never managed to get updates working, other than by downloading the whole thing in XML, manipulating the XML, and pushing it back again – and that only works on the eprint record, I could never work out how to do anything
with the file and document metadata. Andy ==========CURL FRAGMENT==================================== $oaPub_ID=$_REQUEST['oaPub_ID']; # Call this script with the number of the record to upload $ch = curl_init(); $username='XXXXXXXXXX';$password='YYYYYYYYYYYYY';
curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password); curl_setopt($ch, CURLOPT_URL, "http://researchonline.lshtm.ac.uk/id/contents"); curl_setopt($ch, CURLOPT_HEADER, 1); $pkgheader=Array('X-Packaging:
http://eprints.org/ep2/data/2.0', 'Content-Type: text/xml', 'Metadata-Relevant: true', 'X-Verbose: true' , 'In-Progress: false'); # TRUE => user inbox; FALSE => review
curl_setopt($ch,CURLOPT_HTTPHEADER,$pkgheader); // test from static file // $file_in = "$DOCROOT/publications/eprint5.xml"; test file
// $data=""
// live XML fetch $html_in="http://pubdb.lshtm.ac.uk/publications/OAmgr/OAmgr_upload/eprints_xml.php?filter=oaPub_ID&value=$oaPub_ID";
#fetches eprints XML from the staging system $data=""> curl_setopt($ch, CURLOPT_POST,1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); ($result=curl_exec($ch) )|| die( "curl_exec failed: ". curl_error($ch)); echo "<pre>"; echo $result; echo "</pre>"; $links=array(); preg_match('/<link rel="edit" href=""> echo "<a href=''>Result</a>"; $matches=array(); if(preg_match('/\/id\/eprint\/([0-9]*)/',$result,$matches)){ $ID=$matches[1]; print "\n\nID=$ID\n"; echo $result; }else{curl_close($ch); die( "\n\nNo ID found in eprints response: Deposit failed");} // close cURL resource, and free up system resources curl_close($ch); // very crude and verbose reporting, followed by some more stuff the passes the eprint ID back to the staging DB From: eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk]
On Behalf Of Andrew Beeken I tinkered with SWORD a while back but don’t recall making much headway over being able to create a blank record. I think anything more than that was a bit like pulling teeth. From:
eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk]
On Behalf Of Alan.Stiles Hi all, Does anyone have a successful SWORD implementation? I’m trying to access /sword-app/servicedocument and /id/contents via the browser, whilst logged in to the repository and I just get bounced off to a not-authorised page. Not sure if either of those should be legible to me and it’s our access control blocking me, or if I’m not supposed to be able to get to either via a browser and should be doing something via CURL. I’ve seen the SWORD and CRUD pages on
the Wiki but I’m not making any headway at the moment. Cheers, Alan
-- 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.
|
- References:
- [EP-tech] Sword 2.0 access control
- From: "Alan.Stiles" <alan.stiles@open.ac.uk>
- Re: [EP-tech] Sword 2.0 access control
- From: Andrew Beeken <anbeeken@lincoln.ac.uk>
- [EP-tech] Sword 2.0 access control
- Prev by Date: Re: [EP-tech] IRStats2 - maintenance of bazaar package
- Next by Date: Re: [EP-tech] DataCite Doi Plugin
- Previous by thread: Re: [EP-tech] Sword 2.0 access control
- Next by thread: Re: [EP-tech] Sword 2.0 access control
- Index(es):