Skip to content
This repository has been archived by the owner on Jul 2, 2018. It is now read-only.

Collections: Create a new collection

Natasa Bulatovic edited this page Sep 4, 2015 · 10 revisions

##POST /collections Creates a new imeji collection. During collection creation users may explicitly reference or copy an existing metadata profile used by any other collection, or the default imeji metadata profile. For this purpose, JSON Body should contain a snippet referring to the desired metadata profile.

"profile":{
        "id":"id-of-existing-metadata-profile",
        "method":"copy|reference"
    }

If the method is empty or different from "copy" or "reference" new metadata profile will be created.

####Copy existing metadata profile When copying existing metadata profile, collection creator reuses another existing profile as a template, and as soon as the collection is created (thus the profile is copied), collection creator may edit it according to own needs i.e. extend it with another metadata, change labels, remove some existing metadata, etc.

####Reference existing metadata profile When referencing existing metadata profile, collection creator reuses another existing metadata profile by referencing it. Referenced metadata profile can only be edited by the profile creator or administrator (not necessary by collection creator).

####Response status codes #####201 Created Successful creation of the collection

#####400 Bad request The body of the request is not syntactically correct, user provided false body for the request

#####401 Unauthorized Authentication is necessary to create a collection, and user is not authenticated or provided invalid credentials

#####403 Forbidden Wrong credentials provided to create a collection (User does not have a right to create a collection)

#####422 Unprocessable Entity The body of the request is syntactically correct, but data are not semantically correct e.g. missing a mandatory field such as the title of the collection, or user provided a reference to a non-existing metadata profile as a metadata profile for the collection.

####Example request

curl --user admin:admin \
       --header "Content-Type:application/json" \
       --header "Accept: application/json" \
       --request POST \
       --data '{<see_example_request_body_below>}' \
       http://<baseurl>/collections

#####Example request body {
"title":"Research Data", "description":"Test for research data", "versionOf":"", "profile":{ "id":"", "method":"" }, "contributors":[
{
"familyName":"White", "givenName":"John", "completeName":"White, John", "alternativeName":"Lucky Tester", "role":"author", "identifiers":[
{
"type":"imeji", "value":"http://pubman.mpdl.mpg.de/cone/persons/resource/persons96343" } ], "organizations":[
{
"id":"94zMk2OtjJAWtXIH", "name":"Innovations, Max Planck Digital Library, Max Planck Society", "description":"", "identifiers":[
{
"type":"imeji", "value":"someveryspecificIdentifier" } ], "city":"München", "country":"Deutschland" }, {
"name":"Testing organization", "description":"There is no description for the Testing organization", "identifiers":[
{
"type":"imeji", "value":"veryspecific" } ], "city":"Some great city", "country":"Some nice country" } ] }, {
"familyName":"Smith", "givenName":"John", "completeName":"Smith, John", "alternativeName":"", "role":"author", "identifiers":[
{
"type":"imeji", "value":"http://pubman.mpdl.mpg.de/cone/persons/resource/persons96314" } ], "organizations":[
{
"id": "yoKdu0PjrJKWLXRN",
"name":"Max Planck Digital Library, Max Planck Society", "description":"", "identifiers":[
{
"type":"imeji", "value":"nicePersistentId" } ], "city":"", "country":"" } ] } ] }

#####Response

Clone this wiki locally