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

Collections: Create a new share

natasab edited this page Dec 23, 2014 · 7 revisions

##POST /collections/:id/shares Creates a new share for an imeji collection for any of supported operations. For supported operations see Supported collection shares .

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

#####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 share, and user is not authenticated or provided invalid credentials

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

#####404 Not found The collection for which the share is created does not exist

#####422 Unprocessable Entity The body of the request is syntactically correct, but data are not semantically correct e.g. wrong action or user provided, collection is withdrawn, thus no share is allowed.

####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/FKMxUpYdV9N2J4XG/shares

#####Example request body

   {  
    "action":"READ",
    "validUntil":"",
    "userId":"zhcQKsMR0A9SiC6x"
   }

#####Example response body for a successful share creation with response code 201 Created

  {  
    "id":"FKMxUpYdV9N2J4XG11",
    "action":"READ",
    "createdDate":"2014-10-09T13:01:49 +0200",
    "validUntil":"",
    "createdBy":{  
       "fullname":"White, John",
       "userId":"zhcQKsMR0A9SiC6x"
    },
    "assignedTo":{  
       "fullname":"Black, John",
       "userId":"zhcQKsMR0A9SiC6x"
     }
  }
Clone this wiki locally