EPrints Technical Mailing List Archive

See the EPrints wiki for instructions on how to join this mailing list and related information.

Message: #06635


< 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


Urgh, seems like my CURL commands got mangled!

They should be:


curl -v -H "Content-Type: application/vnd.eprints.data+xml;" -X PUT --data-binary @"eprintstest-eprint-41850.xml" -u USERNAME  MailScanner has detected a possible fraud attempt from "kar-test.kent.ac.uk" claiming to be https://someserver.example.org/id/eprint/41850


and to update:

curl -v -H "Content-Type: application/vnd.eprints.data+xml;" -X PUT --data-binary @"eprintstest-eprint-123456.xml" -u USERNAME  MailScanner has detected a possible fraud attempt from "kar-test.kent.ac.uk" claiming to be https://someserver.example.org/id/eprint/123456


​Liam

From: eprints-tech-bounces@ecs.soton.ac.uk <eprints-tech-bounces@ecs.soton.ac.uk> on behalf of Liam Green-Hughes <L.E.Green-Hughes@kent.ac.uk>
Sent: 26 June 2017 17:13
To: 'eprints-tech@ecs.soton.ac.uk'
Subject: Re: [EP-tech] Sword 2.0 access control
 

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
Sent: 20 June 2017 15:55
To: eprints-tech@ecs.soton.ac.uk
Subject: Re: [EP-tech] Sword 2.0 access control

 

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
Sent: 20 June 2017 15:50
To:
eprints-tech@ecs.soton.ac.uk
Subject: [EP-tech] Sword 2.0 access control

 

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.


The University of Lincoln, located in the heart of the city of Lincoln, has established an international reputation based on high student satisfaction, excellent graduate employment and world-class research.


The information in this e-mail and any attachments may be confidential. If you have received this email in error please notify the sender immediately and remove it from your system. Do not disclose the contents to another person or take copies.

Email is not secure and may contain viruses. The University of Lincoln makes every effort to ensure email is sent without viruses, but cannot guarantee this and recommends recipients take appropriate precautions.

The University may monitor email traffic data and content in accordance with its policies and English law. Further information can be found at:
http://www.lincoln.ac.uk/legal.