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

Items: Create a new share

natasab edited this page Dec 23, 2014 · 1 revision

##POST /items/:id/shares Creates a new share for an imeji item for any of supported operations. For supported actions check Supported share actions for Items

####Response status codes #####201 Created Successful creation of the item 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 an item share, and user is not authenticated or provided invalid credentials

#####403 Forbidden Wrong credentials provided to create an item share or not sufficient privileges

#####404 Not found The item 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, item 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>/items/FKMxUpYdV9N2J4XG/shares

#####Example request body

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

If sendEmail is provided and set to "yes" the system will send an email to the user with provided userId. If sendEmail is not provided or set to any other value the system will create the share, but will not send an email to the user with provided userId.

#####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