EPrints Technical Mailing List Archive

Message: #01646


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

[EP-tech] Re: Adding files to an eprint using cURL


Thanks Ian,

I'm not sure about it either.  

I tried this on my own test repository (3.3.11) and on demoprints.eprints.org (3.3.10).

curl -X POST -i -u dkane:maggots22 --data-binary " @dandelion2.JPG" -H 'Content-Disposition: attachment; filename=dandelion2.JPG' -H 'Content-Type: image/jpeg' http://demoprints.eprints.org/id/eprint/214/contents

It created a document in both cases, but on my own repository the document was empty and it worked perfectly on Demoprints.

Could it be the version?

David.


________________________________________
From: eprints-tech-bounces@ecs.soton.ac.uk [eprints-tech-bounces@ecs.soton.ac.uk] on behalf of Ian Stuart [Ian.Stuart@ed.ac.uk]
Sent: 05 March 2013 09:40
To: eprints-tech@ecs.soton.ac.uk
Subject: [EP-tech] Re: Adding files to an eprint using cURL

I'm not sure about your curl command....

I'm using:

curl -i -u username:password --data-binary "@myFile.zip" -H
'X-Packaging: http://opendepot.org/RepNet/1.0' -H 'Content-Type:
application/zip'  http://myrepo.example.com/path/to/use

(SWORD 1.3, but that's not important here)

Note the --data-binary option, and the use of the '@' at the start of
the filename.

On 05/03/13 09:34, David Kane wrote:
> I have had to resort to praying to the EPrints angel, for the answer to
> this one.  We are trying to write a simple PHP cURL wrapper for the
> eprints functionality/API in CRUD.pm.
>
> We have got so far, but are not able to add documents.  We have tried
> several approaches including adding a complete EP xml object, with files
> embedded and have tried to add only the <documents> sub object to a
> pre-existing eprint, using cURL.
>
> Nothing seems to work, and I don't know what is wrong.  Our latest
> attempt is to add the files as a POST attachment.
>
> curl -X POST -i -u dkane:maggots22 -d 'Hello, World!' -H
> 'Content-Disposition: attachment; filename=/var/www/test.xml' -H
> 'Content-Type: text/plain' http://witeprints/id/eprint/26/contents
>
> A lot of this is documented in
> http://wiki.eprints.org/w/API:EPrints/Apache/CRUD
>
> We are out of luck at the moment.  Could it be a bug?  If somebody else
> could try this CURL command, we'd be much obliged.  We are working on
> EPrints 3.3.11
>
> Many thanks,
>
> David Kane.
>
> --
> David Kane, MLIS.
> Systems Librarian
> Waterford Institute of Technology
> Ireland
> http://library.wit.ie/
> T: ++353.51302838
> M: ++353.876693212
>
>
> *** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
> *** Archive: http://www.eprints.org/tech.php/
> *** EPrints community wiki: http://wiki.eprints.org/
>


--

Ian Stuart.
Developer: ORI, RJ-Broker, and OpenDepot.org
Bibliographics and Multimedia Service Delivery team,
EDINA,
The University of Edinburgh.

http://edina.ac.uk/

This email was sent via the University of Edinburgh.

The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/