Publishing an Object Body
Kii Cloud provides a publishing feature that makes your file accessible to users through a web browser via the Internet.
When you publish an object body, an HTTPS URL to the kii.com domain is assigned. End users can access this URL and view and download the object body data through a web browser.
See an example of an assigned URL below. In this case, we assume that you've selected the "United States" as the server location in the developer portal (Your AppID replaces
To publish an object body, the user needs to have the read permission on the KiiObject. Note that the object body will be accessible to anyone once it is published even if the bucket of the KiiObject is in a user scope or group scope.
You can publish an object body in the following ways. With the REST API, you can not specify a period of time but specify a time.
- Publish with no expiration time
- Publish for a certain period of time (e.g. one hour from now)
- Publish until the designated time (e.g. until December 31, 2099)
When the expiration time is passed, the URL will be invalidated and users will be no longer able to download the file. When users attempt to access the file via a web browser, they will get the HTTP status code 410 (Gone).
If the object body or the KiiObject is deleted, users will get the HTTP status code 404 (Not Found) even if the URL is still valid.
You can set the content type of an object body. The content type will be included in the HTTPS response header and controls how web browsers handle the object body. For example, the content type "image/jpeg" will present the file as an image while the content type "application/octet-stream" will download the file.
When you use the simple transfer, you set the content type upon uploading a file. When you use the resumable transfer, the content type is automatically set according to the file extension (if the file does not have any extension,
application/octet-stream is set).
When the API is called for publishing an object body, Kii Cloud issues an HTTPS URL that is accessible to a web browser. If the API is called multiple times, multiple URLs are associated with one KiiObject as illustrated in the figure below.
Note the following points:
A URL is not bound to a file but a KiiObject. If you update an object body, the updated file will become accessible even with the same URL.
You can assign a different expiration time on each URL. As shown in the above figure, you can selectively expire a specific URL.
Once an object body is published, you cannot invalidate the URL before the expiration time. Delete the KiiObject if you need to hide the URL.
In order to publish an object body, its upload needs to be completed. You cannot publish an object body prior to uploading it or in the middle of upload.