Publishing a File without Expiration

To publish a file without expiration, use the following command. The URL will remain valid and the file will be accessible forever.

curl -v -X POST \
  -H "Authorization: Bearer {ACCESS_TOKEN}" \
  -H "Content-Type: application/vnd.kii.ObjectBodyPublicationRequest+json" \
  -H "Accept: application/vnd.kii.ObjectBodyPublicationResponse+json" \
  "https://api.kii.com/api/apps/{APP_ID}/groups/{GROUP_ID}/buckets/{BUCKET_ID}/objects/{OBJECT_ID}/body/publish"

Kii Cloud returns a respond like the following example.

< 201
< Expires: Wed, 14 Aug 2013 06:59:27 GMT
< Location: https://api.kii.com/api/x/{PUBLICATION_ID}
< Content-Type: application/vnd.kii.ObjectBodyPublicationResponse+json

{
  "publicationID" : {PUBLICATION_ID},
  "url" : "https://api.kii.com/api/x/{PUBLICATION_ID}"
}

The URL for accessing the object body is included in the response body.

Note that a user needs to be permitted the READ_EXISTING_OBJECT action on a KiiObject to publish its object body (Once published, anyone can access the object body with the URL). See Setting a KiiObject's ACL for more information about the access rights.