Nice, Peter! For sure i'll help with the doc!! I just have to figure out how to do it (edit the doc page), but as soon as i have some spare time i'll login into Irc and there it is easier to get some help.
About updating the API, i don't think i have enough Java skills yet to do it, but i'll take a look. 2015-01-15 17:16 GMT-02:00 Peter Dietz <[email protected]>: > Hi Bruno, > > I've made an update to the DSpace 5.x documentation at: > https://wiki.duraspace.org/display/DSDOC5x/REST+API > It has a list of all the endpoints. I've been passing through and adding an > example CURL command + JSON data for endpoints. You could help enhance the > wiki documentation too. > > Regarding not being able to create an item with a bitstream in one pass, if > your handy with Java, feel free to customize the REST API for your local > institution to support that. If it simplifies the process, it could be > something that could be contributed to the API for DSpace 6. > > ________________ > Peter Dietz > Longsight > www.longsight.com > [email protected] > p: 740-599-5005 x809 > > On Tue, Jan 13, 2015 at 2:33 PM, Bruno Zanette <[email protected]> > wrote: >> >> Thanks, once again, Peter!! >> >> I've figured out what you've said yesterday. I was doing some tests >> before posting my findings here. Everything seems to work fine. I was >> expecting to be more simple to do this, with only one request, but >> it's not that hard. >> >> I'll try to find some time to write it down and maybe someone can use >> to update the official doc. >> Right now i'm struggling to learn Ruby (On Rails) to write a simple >> app that implements these steps. >> >> The steps (actions) to create an item and append a bitstream to it are: >> >> ---------------------------------------------------------------------- >> 1) collections/<ITEM_ID>/items >> >> -> Create a new item. The format of the request is the following (must >> have other possible tags): >> >> <?xml version="1.0"?> >> <item> >> <metadata> >> <key>dc.XXX.YYY</key> >> <value>VALUE</value> >> <language>LANG</language> >> </metadata> >> <metadata>...</metadata> >> ... >> </item> >> >> * ShellScript command: >> curl -k -i -4 \ >> -H "Content-Type: application/xml" \ >> -H "rest-dspace-token: ${TOKEN}" \ >> -X POST ${DSPACEURL}/${ACTION} \ >> -d@${ITEM_METADATA} >> >> ---------------------------------------------------------------------- >> >> 2) items/<ITEM_ID>/bitstreams >> >> -> At this step only the upload of file is done. Any metadata is sent. >> Maybe there is a way to do this but i couldn't figure it out how to do >> it yet. >> >> * ShellScript command: >> curl -k -i -4 \ >> -H "rest-dspace-token: ${TOKEN}" \ >> -X POST ${DSPACEURL}/${ACTION} \ >> -F upload=@"${FILE}" >> >> ---------------------------------------------------------------------- >> >> 3) bitstreams/<BITSTREAM_ID> >> >> -> At this step is sent the missing metadata of the previous uploaded >> file. >> The format of the request is the following (must have other possible >> tags): >> >> <?xml version="1.0"?> >> <bitstream> >> <name>FILE_NAME.xyz</name> >> <description>DESCRIPTION OF THE FILE</description> >> <type>bitstream</type> >> <bundleName>ORIGINAL</bundleName> >> <format>ITEM FORMAT</format> >> <mimeType>MIME/TYPE</mimeType> >> </bitstream> >> >> * ShellScript command: >> curl -k -i -4 \ >> -H "Content-Type: application/xml" \ >> -H "rest-dspace-token: ${TOKEN}" \ >> -X PUT ${DSPACEURL}/${ACTION} \ >> -d@${FILE_METADATA} >> >> ---------------------------------------------------------------------- >> >> 2015-01-13 16:36 GMT-02:00 Peter Dietz <[email protected]>: >> > Hey Bruno, >> > >> > Sorry for the delay, very busy. >> > >> > Also, sorry that the documentation for DSpace 5 REST API isn't complete >> > yet. >> > Feel free to contribute as you discover how things work. >> > >> > >> > It looks like you need to first create the item, as you are currently >> > doing >> > it: >> > POST /collections/{collectionID}/items >> > >> > (Don't post the bitstream, only the item metadata is respected, item >> > bitstream is ignored) >> > >> > That returns you an Item, and (including its ID). >> > >> > Then, you can pass the data of your file to >> > POST /items/{itemID}/bitstreams >> > >> > Reading the code might be necessary, until the documentation is fully >> > comprehensive. >> > >> > https://github.com/DSpace/DSpace/blob/master/dspace-rest/src/main/java/org/dspace/rest/ItemsResource.java#L411 >> > >> > ________________ >> > Peter Dietz >> > Longsight >> > www.longsight.com >> > [email protected] >> > p: 740-599-5005 x809 >> > >> > On Mon, Jan 12, 2015 at 7:36 AM, Bruno Zanette <[email protected]> >> > wrote: >> >> >> >> anyone? >> >> >> >> 2015-01-09 12:35 GMT-02:00 Bruno Zanette <[email protected]>: >> >> > Hi, I'm trying to upload files via REST-API but it is not working. >> >> > >> >> > In the way i'm doing the requests the items are being successfully >> >> > created but without any file. >> >> > >> >> > To do the tests i'm using Curl with the following options: >> >> > >> >> > curl -v -k -i -4 \ >> >> > -H "Content-Type: application/zip" \ >> >> > -H "rest-dspace-token: " \ >> >> > -X POST https://localhost:8443/rest/collections/1/items \ >> >> > [email protected] >> >> > >> >> > The content of file "request.xml" is the end of the message. I wrote >> >> > it based on the result of a GET_ITEM request of an item submitted via >> >> > XMLUI API. >> >> > >> >> > I'm using Dspace-master branch (5.0 Rc3), installed of Ubuntu 14.04. >> >> > >> >> > Does anyone knows how to do it? >> >> > Am I doing the request correctly? >> >> > Any tips? >> >> > >> >> > I've already tried to send zip files but it fails with a message of >> >> > "Unsupported media type"... >> >> > >> >> > Thanks! >> >> > >> >> > >> >> > >> >> > -------------------------------------------------------------------------------- >> >> > <item> >> >> > <name>TITLE</name> >> >> > <type>item</type> >> >> > <archived>true</archived> >> >> > >> >> > <bitstreams> >> >> > <id>1</id> >> >> > <name>servicedocument</name> >> >> > <type>bitstream</type> >> >> > <bundleName>ORIGINAL</bundleName> >> >> > <checkSum >> >> > checkSumAlgorithm="MD5">63634883c3cc2b837895c3b8bda9e815</checkSum> >> >> > <description>SERVICE_DOCUMENT</description> >> >> > <format>Unknown</format> >> >> > <mimeType>application/octet-stream</mimeType> >> >> > <retrieveLink>/bitstreams/1/retrieve</retrieveLink> >> >> > <sequenceId>1</sequenceId> >> >> > <sizeBytes>2758</sizeBytes> >> >> > </bitstreams> >> >> > >> >> > <lastModified>2015-01-08 14:54:48.816</lastModified> >> >> > <metadata><key>dc.contributor.author</key><value>ULTIMO, >> >> > PRIMEIRO</value></metadata> >> >> > >> >> > <metadata><key>dc.date.issued</key><value>1234-12-12</value></metadata> >> >> > >> >> > >> >> > <metadata><key>dc.identifier.citation</key><language>pt_BR</language><value>CITATION</value></metadata> >> >> > >> >> > >> >> > <metadata><key>dc.description</key><language>pt_BR</language><value>DESCRICAO</value></metadata> >> >> > >> >> > >> >> > <metadata><key>dc.description.abstract</key><language>pt_BR</language><value>ABSTRACT</value></metadata> >> >> > >> >> > >> >> > <metadata><key>dc.language.iso</key><language>pt_BR</language><value>pt_BR</value></metadata> >> >> > >> >> > >> >> > <metadata><key>dc.publisher</key><language>pt_BR</language><value>PUBLISHER</value></metadata> >> >> > >> >> > >> >> > <metadata><key>dc.title</key><language>pt_BR</language><value>TITULO</value></metadata> >> >> > >> >> > >> >> > <metadata><key>dc.title.alternative</key><language>pt_BR</language><value>OUTROS_TITULOS</value></metadata> >> >> > >> >> > >> >> > <metadata><key>dc.type</key><language>pt_BR</language><value>Dataset</value></metadata> >> >> > <withdrawn>false</withdrawn> >> >> > </item> >> >> > >> >> > >> >> > -------------------------------------------------------------------------------- >> >> > -- >> >> > Bruno Nocera Zanette >> >> > +55 41 9992-2508 >> >> >> >> >> >> >> >> -- >> >> Bruno Nocera Zanette >> >> +55 41 9992-2508 >> >> >> >> >> >> >> >> ------------------------------------------------------------------------------ >> >> New Year. New Location. New Benefits. New Data Center in Ashburn, VA. >> >> GigeNET is offering a free month of service with a new server in >> >> Ashburn. >> >> Choose from 2 high performing configs, both with 100TB of bandwidth. >> >> Higher redundancy.Lower latency.Increased capacity.Completely >> >> compliant. >> >> vanity: www.gigenet.com >> >> _______________________________________________ >> >> DSpace-tech mailing list >> >> [email protected] >> >> https://lists.sourceforge.net/lists/listinfo/dspace-tech >> >> List Etiquette: >> >> https://wiki.duraspace.org/display/DSPACE/Mailing+List+Etiquette >> > >> > >> >> >> >> -- >> Bruno Nocera Zanette >> +55 41 9992-2508 > > -- Bruno Nocera Zanette +55 41 9992-2508 ------------------------------------------------------------------------------ New Year. New Location. New Benefits. New Data Center in Ashburn, VA. GigeNET is offering a free month of service with a new server in Ashburn. Choose from 2 high performing configs, both with 100TB of bandwidth. Higher redundancy.Lower latency.Increased capacity.Completely compliant. http://p.sf.net/sfu/gigenet _______________________________________________ DSpace-tech mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/dspace-tech List Etiquette: https://wiki.duraspace.org/display/DSPACE/Mailing+List+Etiquette

