Helge,

I've just remembered that you can also use other methods to achieve
this same goal.

If you have access to the server it must exist a way to use
"[webapp_dir]/bin/dspace" command to create communities/collections. I
know that it can create Items using "import" option, but never tested
for Comm/Coll. Also there is SWORD/SWORDv2 APIs that i believe can do
it. Unfortunately i don't have much knowledge on neither of them, but
it can be a solution if you're not willing to update Dspace version
only to use REST API.

2015-01-29 11:58 GMT-02:00 Bruno Zanette <brunonzane...@gmail.com>:
> Helge,
>
> First of all, on DSpace 4.x only GET requests are enabled. POST/PUT
> requests were only introduced in DSpace 5. So, if you need to POST a
> community using REST-API you will need to upgrade your installation.
>
> Second, almost every documentation about it are outdated and wrong.
> The only doc-page that is correct is this one:
> https://wiki.duraspace.org/display/DSDOC5x/REST+API
> It was updated some days ago, and i'm planning to help on this since
> i've managed to discover how to use it.
> But for now, you can take a look at this email in which i explain how
> to post an item and a bitstream. The request format to post a
> community should be very similar, but i haven't tested posting a
> community yet so i can't be sure.
>
> Also, if you are interested, i and my teammates are creating a
> 'Dspace-Rest-Api' Ruby Gem:
> http://sourceforge.net/p/dspace/mailman/message/33283229/
> https://gitlab.c3sl.ufpr.br/bnzanette/dspace-rest-client
>
> It is very early on development but it already has some functional features.
>
> I'll do my best to find some time today to update the doc page and do
> some tests with communities.
>
> Cheers!
>
> 2015-01-29 11:15 GMT-02:00 Helge Opedal <helge.ope...@it.uib.no>:
>> Hi,
>> I am trying to batch create communities in DSpace from command line on a
>> Redhat server. The server is a RHEL6 and the installation is a vanilla
>> DSpace 4.2.
>>
>> I am able to get information about existing Communitites in my DSpace
>> installation with a curl command like this:
>> curl -i -H "user:usern...@something.uib.no" -H "pass:XXXXXX" -H
>> "Content-Type: text/xml" -X GET "http://localhost:8080/rest/communities";
>>
>> The result is given out:
>>> [{"id":1,"name":"IT
>>> avdelingen","handle":"123456789/1","type":"community","link":"/rest/communities/1","expand":["parentCommunity","collections","subCommunities","log
>>> o","all"],"logo":null,"parentCommunity":null,"copyrightText":"","introductoryText":"felles","shortDescription":"ITA","sidebarText":"","countItems":1,"collections":[],
>>> "subcommunities":[]}]
>>
>> But, when I try to POST data, I can understand how it should be done.
>> I am trying to do something like this:
>>
>>> curl -X POST -i -H "user:usern...@something.uib.no" -H "pass:XXXXXXX"
>>> -H "Content-Type: application/json" -d "{'communityId':'1','name':'A
>>> test community','shortDescription':'Community created with JSON'}"
>>> "http://localhost:8080/rest/communities";
>>
>> which might not be the correct way. I have tried others also. The answer
>> from Tomcat is:
>>
>>> HTTP/1.1 405 Method Not Allowed
>>> Server: Apache-Coyote/1.1
>>> Allow: GET,OPTIONS,HEAD
>>> Content-Type: text/html;charset=utf-8
>>> Content-Length: 1034
>>> Date: Thu, 29 Jan 2015 13:13:12 GMT
>>>
>>> <html><head><title>Apache Tomcat/6.0.24 - Error
>>> report</title><style><!--H1
>>> {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;}
>>> H2
>>> {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;}
>>> H3
>>> {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;}
>>> BODY
>>> {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;}
>>> B
>>> {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;}
>>> P
>>> {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A
>>> {color : black;}A.name {color : black;}HR {color :
>>> #525D76;}--></style> </head><body><h1>HTTP Status 405 - Method Not
>>> Allowed</h1><HR size="1" noshade="noshade"><p><b>type</b> Status
>>> report</p><p><b>message</b> <u>Method Not
>>> Allowed</u></p><p><b>description</b> <u>The specified HTTP method is
>>> not allowed for the requested resource (Method Not
>>> Allowed).</u></p><HR size="1" noshade="noshade"><h3>Apache
>>> Tomcat/6.0.24</h3></body></html>
>>
>> The documentation that I try to follow (and understand) is this one:
>> * https://jspace.atlassian.net/wiki/display/DSPACEAPI/POST_communities
>>
>> Can someone please point me in the right direction in how to be able to
>> POST to DSpace API to be able to create communities (and other elements
>> later on)?
>>
>> My goal is to be able to create from another data source maybe a couple
>> of hundreds or thousands communities in 1 DSpace installation, and I can
>> not do this by the xmlui web interface, because it would take way to
>> much time.
>>
>> Thank you very much,
>>
>> best regards,
>>
>> Helge
>> University of Bergen
>> Norway
>>
>>
>> ------------------------------------------------------------------------------
>> Dive into the World of Parallel Programming. The Go Parallel Website,
>> sponsored by Intel and developed in partnership with Slashdot Media, is your
>> hub for all things parallel software development, from weekly thought
>> leadership blogs to news, videos, case studies, tutorials and more. Take a
>> look and join the conversation now. http://goparallel.sourceforge.net/
>> _______________________________________________
>> DSpace-tech mailing list
>> DSpace-tech@lists.sourceforge.net
>> 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

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
DSpace-tech mailing list
DSpace-tech@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspace-tech
List Etiquette: https://wiki.duraspace.org/display/DSPACE/Mailing+List+Etiquette

Reply via email to