Object Collection

Location /api/apps/{appID}/things/{thingID}/buckets/{bucketID}/objects
This resource represents a collection of objects

Request Headers (Applies to all methods)

Authorization
header
Required: Yes

POST

/api/apps/{appID}/things/{thingID}/buckets/{bucketID}/objects

Description

Create a new object in the bucket.

If the target bucket does not exist, the bucket will be created and a new object will be created in the bucket.

Security

The administrator can execute this action. For other users, the permission to execute this action is determined either by the ACL set on the scope in which the bucket belongs (if the target bucket does not exist) or by the ACL set on the bucket (if the target bucket already exists).

Content-Type application/json

The content of the object.

You can use the Content-Type "application/json" if you do not need to set any specific data type on the object. If you want to set a specific data type, please use the Content-Type "application/vnd.{appID}.{dataType}+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
Responses
201

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

The new object has been created
Headers
Name Type Description
Location string The URI of the object.
ETag string The version of the object.
Contents
Name Type Description
objectID string The ID of the object.
createdAt long The creation date of the object in Unix epoch (milliseconds in UTC).
dataType string The data type of the object.
404

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

The thing was not found.
Contents
Name Type Description
errorCode string Error code "THING_NOT_FOUND".
message string The error message.
field string The field used for searching the thing. This can be the "thingID" or "vendorThingID" field.
value string The field value used for searching the thing.
appID string The ID of the application.
401

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

Not authorized to post the object data
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).