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

Collections: Update a collection

natasab edited this page Dec 22, 2014 · 14 revisions

####Response status codes #####200 OK Successful update of the collection with provided :id

#####404 Not found The collection with provided :id is not found (does not exist)

#####401 Unauthorized Authentication is necessary to update this collection

#####403 Forbidden Wrong credentials provided to update this collection (e.g. pending collection, but a user who is not creator of this collection or does not have a share for this collection tries to update it)

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

#####422 Unprocessable Entity Wrong data provided for the collection e.g. user did not provide a title for the collection (title is mandatory attribute)

##PUT /collections/:id

  • Updates a collection with this collection id
  • If user does not provide any value for some metadata of the collection, the system will remove these collection metadata (e.g. description).
  • If user provides any value for some system generated metadata (see request body example below), the system will ignore these values

####Example request

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

#####Example request body {
"id":"FKMxUpYdV9N2J4XG", /* Following collection data in the comment are not editable, they are automatically provided by the system. / / "createdBy": { "fullname": "Saquet, Bastien", "userId": "zhcQKsMR0A9SiC6x" }, "modifiedBy": { "fullname": "admin, admin", "userId": "w7ZfmmC5LQR8KJIN" }, "createdDate": "2014-10-09T13:01:49 +0200", "modifiedDate": "2014-12-02T15:43:31 +0100", "versionDate": "2014-10-16T11:15:53 +0200", "status": "RELEASED", "version": 1, "discardComment": "", */ "title":"Research Data", "description":"Test for research data", "contributors":[
{
"position":0, "id":"Od6MTBSdXYPWYSU1", "familyName":"White", "givenName":"John", "completeName":"White, John", "alternativeName":"", "role":"author", "identifiers":[
{
"type":"imeji", "value":"http://pubman.mpdl.mpg.de/cone/persons/resource/persons96343" } ], "organizations":[
{
"position":0, "id":"94zMk2OtjJAWtXIH", "name":"Innovations, Max Planck Digital Library, Max Planck Society", "description":"", "identifiers":[
{
"type":"imeji", "value":"escidoc:persistent1" } ] } }

####Example response body

##PATCH /collections/:id Partially updates the collection (subset of any of the collection information) will only update this information.

#####Example request

####Example request

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

#####Example request body (updating only title and description)

 {
   "title":"Test Title Updated",
   "description":"Test Description Updated",
 }

#####Example request body (updating only the name and the description of the first author organization)

   {
     "contributors":[  
         {  
             "position":0,
             "organizations":[  
                 {  
                     "name":"The updated name of the organization",
                     "description":"The updated description of the organization"
                  }
               ]
          }
        ]
     }

####Example response body Returns back the updated information snippet e.g.

 {
   "title":"Test Title Updated",
   "description":"Test Description Updated",
 }

or

 {
  "contributors":[  
         {  
             "position":0,
             "id":"Od6MTBSdXYPWYSU1",
             "familyName":"White",
             "givenName":"John",
             "completeName":"White, John",
             "alternativeName":"",
             "role":"author",
             "identifiers":[  
                 {  
                     "type":"imeji",
                     "value":"http://pubman.mpdl.mpg.de/cone/persons/resource/persons96343"
                 }
               ],
             "organizations":[  
                 {  
                     "position":0,
                     "id":"94zMk2OtjJAWtXIH",
                     "name":"The updated name of the organization",
                     "description":"The updated description of the organization",
                     "identifiers":[  
                         {  
                             "type":"imeji",
                             "value":"escidoc:persistent1"
                         }
                      ]
                  }
               ]
             }
          }
Clone this wiki locally