Body

Location /api/apps/{appID}/buckets/{bucketID}/objects/{objectID}/body
This resource represents the object body

Request Headers (Applies to all methods)

Authorization
header
Required: Yes

HEAD

/api/apps/{appID}/buckets/{bucketID}/objects/{objectID}/body

Description

Verify if the object has a body.

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.

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
Responses
204

Content-Type (None)

Note This response has no contents.
Headers
Name Type Description
Last-Modified datetime The modification date of the object.
ETag string The version of the object body.
Content-Type string The content type of the object body.
404

Content-Type (None)

The object body was not found.
401

Content-Type (None)

Not authorized to check the object body.

GET

/api/apps/{appID}/buckets/{bucketID}/objects/{objectID}/body

Description

Retrieve the object body.

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.

Content-Type application/json

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
If-Match No string The version of the object body.
Range No string The range of bytes to download. Please specify this header when you want to download the object body in multiple pieces. Set the range as "bytes=from-to", like "bytes=0-1048575".
Responses
200

Content-Type */*

The whole body is successfully retrieved. The media type depends on the body content (e.g., application/jpg).
Headers
Name Type Description
ETag string The version of the object body.
206

Content-Type */*

A portion of the object body, specified by the "Range" header, is successfully retrieved. The media type depends on the body content (e.g., application/jpg).
Headers
Name Type Description
ETag string The version of the object body.
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 get the object 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).
412

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

The specified object body version did not match with the one set on the uploaded body.
Contents
Name Type Description
errorCode string Error code "OBJECT_BODY_INTEGRITY_NOT_ASSURED".
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.
416

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

The requested range was not satisfiable.
Contents
Name Type Description
errorCode string Error code "OBJECT_BODY_RANGE_NOT_SATISFIABLE".
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.
from long Object body chunk starts from.
to long Object body chunk ends to.
total long The total size of object body chunk.

PUT

/api/apps/{appID}/buckets/{bucketID}/objects/{objectID}/body

Description

Add or replace the object body.

By setting the "If-Match: {VERSION}" header, you can execute the conditional object body update.

  • If the "If-Match: {VERSION}" header is provided with an objectID of the existing object, the object body will be replaced only if it is not updated on the server (i.e., if the object body version is not stale). Otherwise, the object body update will fail with a 412 response. Providing an objectID of the non-existent object with this header will also fail with a 404 response.

If no "If-Match: {VERSION}" header is set in the request, the object body will be added or replaced unconditionally. This the same when you set the "If-None-Match: *" header.

You cannot set the "If-Match: {VERSION}" and "If-None-Match: *" headers at the same time.

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.

Content-Type {givenType}

The media type of the body content (e.g., application/jpg if the object body is a jpg image file).

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
If-Match No string The version of the object body.
If-None-Match No string Can have only "*" as value.
Responses
200

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

Headers
Name Type Description
Last-Modified datetime The modification date of the object
ETag string The version of the object body.
Contents
Name Type Description
modifiedAt long The modification date of the object in Unix epoch (milliseconds in UTC).
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.
401

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

Not authorized to put the object 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).
412

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

The specified object body version did not match with the one set on the uploaded body.
Contents
Name Type Description
errorCode string Error code "OBJECT_BODY_INTEGRITY_NOT_ASSURED".
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.

DELETE

/api/apps/{appID}/buckets/{bucketID}/objects/{objectID}/body

Description

Delete the object body.

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.

Content-Type application/json

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
If-Match No string The version of the object body.
If-None-Match No string Can have only "*" as value.
Responses
204

Content-Type (None)

The object body has been deleted successfully
Note This response has no contents.
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 get the object 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).
412

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

The specified object body version did not match with the one set on the uploaded body.
Contents
Name Type Description
errorCode string Error code "OBJECT_BODY_INTEGRITY_NOT_ASSURED".
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.