Publish

Location /api/apps/{appID}/users/me/buckets/{bucketID}/objects/{objectID}/body/publish
This resource allows to publish the object body.

Request Headers (Applies to all methods)

Authorization
header
Required: Yes

POST

/api/apps/{appID}/users/me/buckets/{bucketID}/objects/{objectID}/body/publish

Description

Publish the object body and get its URL.

Security

The administrator can execute this action. For other users, the permission to execute this action is determined by the ACL set on the object. This action requires the read permission.

Content-Type application/vnd.kii.ObjectBodyPublicationRequest+json

You can set an expiration time on the published object body. The expiration time can be set with the parameter "expiresAt" or "expiresIn". You can set only one of them.

Headers
Name Required? type Description
Authorization Yes string Authorization can be of type Basic or Bearer.
  • Authorization Basic: header for granting an anonymous access.
    • Set a Base64-encoded string of AppID and AppKey concatenated with a colon (APP_ID:APP_KEY).
    • The header should look like:
      Authorization: Basic czZCaGRSa3F0Mzo3RmpmcDBaQnIxS3REUmJuZlZkbUl3
  • Authorization Bearer: using Oauth2 Bearer Token.
    • The header should look like:
      Authorization: Bearer ht5fpHQAyrPPwLftK1rAqllv5WNVPCnYfPiCvPocFuQ
Params
Name Required? Type Description
expiresAt long The expiration date of the publication URL. The date should be in UNIX epoch time in milliseconds.
expiresIn int The lifetime of the publication URL (in seconds)
Sample Request
{
  "expiresAt": "[long]",
  "expiresIn": "[int]"
}
Responses
200

Content-Type application/vnd.kii.ObjectBodyPublicationResponse+json

The body has been published successfully.
Contents
Name Type Description
publicationID string The ID of the publication
url string The URL to access the published content
404

Content-Type application/vnd.kii.UserNotFoundException+json

The user was not found.
Contents
Name Type Description
errorCode string Error code "USER_NOT_FOUND".
message string The error message.
field string The field used for searching the user. This can be the userID or address field.
value string The field value used for searching the user.
appID string The ID of the application.
404

Content-Type application/vnd.kii.ObjectNotFoundException+json

The object was not found.
Contents
Name Type Description
errorCode string Error code "OBJECT_NOT_FOUND".
message string The error message.
objectScope ObjectScope The scope of the object.
appID string The ID of the application.
userID string The ID of the user. Only provided for a user-scope bucket.
groupID string The ID of the group. Only provided for a group-scope bucket.
thingID string The ID of the thing. Only provided for a thing-scope bucket.
type string One of "APP", "APP_AND_USER", "APP_AND_GROUP", or "APP_AND_THING".
bucketID string The ID of the bucket.
objectID string The ID of the object that was not found.
404

Content-Type application/vnd.kii.ObjectBodyNotFoundException+json

The object body was not found.
Contents
Name Type Description
errorCode string Error code "OBJECT_BODY_NOT_FOUND".
message string The error message.
objectScope ObjectScope The scope of the object.
appID string The ID of the application.
userID string The ID of the user. Only provided for a user-scope bucket.
groupID string The ID of the group. Only provided for a group-scope bucket.
thingID string The ID of the thing. Only provided for a thing-scope bucket.
type string One of "APP", "APP_AND_USER", "APP_AND_GROUP", or "APP_AND_THING".
bucketID string The ID of the bucket.
objectID string The ID of the object that does not have body.
401

Content-Type application/vnd.kii.UnauthorizedAccessException+json

Not authorized to publish the body.
Contents
Name Type Description
errorCode string Error code "UNAUTHORIZED".
message string The error message.
authenticatedAppID string The authenticated appID.
authenticatedPrincipalID string The authenticated principal ID (userID or thingID).