EPrints Technical Mailing List Archive
Message: #06634
< 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: Liam Green-Hughes <L.E.Green-Hughes@kent.ac.uk>
- Date: Mon, 26 Jun 2017 16:13:36 +0000
Hi everyone,
We have working SWORD integration. We were told these commands to create new records and updates:
Record creation: curl -v -H "Content-Type: application/vnd.eprints.data+xml;" -X POSThttps://someserver.example.org/id/contents
and updates... https://someserver.example.org/id/eprint/123456
To generate the file for the update I went to "Actions" -> "Export" -> "EP3 with File XML" - this gives you an XML file with the correct
EPrint and file IDs.
Additionally, we paid for some work from EPrints a little while ago to correct an issue when updating documents. I think it was an issue with the document ids not being honoured which caused problems updating document metadata. We have a patch for this and
I think it is in 3.4, but not sure the patch made it to 3.3.
Hope this helps Liam Green-Hughes
Library Systems Developer
University of Kent
From: eprints-tech-bounces@ecs.soton.ac.uk <eprints-tech-bounces@ecs.soton.ac.uk> on behalf of Andy Reid <Andy.REID@lshtm.ac.uk>
Sent: 20 June 2017 17:45 To: 'eprints-tech@ecs.soton.ac.uk' Subject: Re: [EP-tech] Sword 2.0 access control 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>
- Re: [EP-tech] Sword 2.0 access control
- From: Andy Reid <Andy.REID@lshtm.ac.uk>
- [EP-tech] Sword 2.0 access control
- Prev by Date: Re: [EP-tech] Tim Miles-Board
- Next by Date: Re: [EP-tech] Sword 2.0 access control
- Previous by thread: Re: [EP-tech] Sword 2.0 access control
- Next by thread: Re: [EP-tech] Sword 2.0 access control
- Index(es):