Request Headers (Applies to all methods)
POST
/api/apps/{appID}/things
Register a new thing in the current application.
Content-Type application/vnd.kii.ThingRegistrationRequest+json
The various attributes of the thing. In addition to the predefined fields listed in the Params section, you can add arbitrary custom fields. Custom fields can have any JSON value, including nested JSONs and arrays. Please note that the custom field has the following restrictions:
- The whole size of all custom fields (field names + values) should not exceed 63 KB.
- Custom fields are not indexed, thus you will not be able to query things with these fields.
- The custom field name cannot start with "_". The field starting with "_" will be ignored and not stored.
- 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
{
"_vendorThingID": "[string]",
"_thingType": "[string]",
"_vendor": "[string]",
"_firmwareVersion": "[string]",
"_productName": "[string]",
"_lot": "[string]",
"_password": "[string]",
"_stringField1": "[string]",
"_stringField2": "[string]",
"_stringField3": "[string]",
"_stringField4": "[string]",
"_stringField5": "[string]",
"_numberField1": "[long]",
"_numberField2": "[long]",
"_numberField3": "[long]",
"_numberField4": "[long]",
"_numberField5": "[long]"
}
Content-Type application/vnd.kii.ThingRegistrationResponse+json
Name | Type | Description |
---|---|---|
Location | string | URI to the new registered thing |
Name | Type | Description |
---|---|---|
_thingID | string | The identifier of the thing generated by Kii Cloud. |
_vendorThingID | string | The provided identifier of the thing. |
_thingType | string | The type of the thing. |
_vendor | string | The vendor of the thing. |
_firmwareVersion | string | The firmware version of the thing. |
_productName | string | The product name. |
_lot | string | The production lot. |
_created | long | The creation date of the thing in UNIX epoch format (msec in UTC). |
_stringField1 | string | The field for storing arbitrary string data. |
_stringField2 | string | The field for storing arbitrary string data. |
_stringField3 | string | The field for storing arbitrary string data. |
_stringField4 | string | The field for storing arbitrary string data. |
_stringField5 | string | The field for storing arbitrary string data. |
_numberField1 | long | The field for storing arbitrary numeric data. |
_numberField2 | long | The field for storing arbitrary numeric data. |
_numberField3 | long | The field for storing arbitrary numeric data. |
_numberField4 | long | The field for storing arbitrary numeric data. |
_numberField5 | long | The field for storing arbitrary numeric data. |
Content-Type application/vnd.kii.ThingAlreadyExistsException+json
Name | Type | Description |
---|---|---|
errorCode | string | Error code "THING_ALREADY_EXISTS". |
message | string | The error message. |
field | string | The field used for checking the duplication. It can be "thingID" or "vendorThingID". |
value | string | The value of the field. |
Content-Type application/vnd.kii.ValidationException+json
- A mandatory field is not provided in the request
- The value of a thing field is invalid
- The custom fields exceed the maximum allowed size
Name | Type | Description |
---|---|---|
errorCode | string | Error code "INVALID_INPUT_DATA". |
message | string | The error message. |
POST
/api/apps/{appID}/things
Register a new thing in the current application and obtain an access token for the thing.
Only the administrator can obtain a persistent access token. A non-persistent access token can be obtained by anyone without any authorization.
Content-Type application/vnd.kii.ThingRegistrationAndAuthorizationRequest+json
The various attributes of the thing. In addition to the predefined fields listed in the Params section, you can add arbitrary custom fields. Custom fields can have any JSON value, including nested JSONs and arrays. Please note that the custom field has the following restrictions:
- The whole size of all custom fields (field names + values) should not exceed 63 KB.
- Custom fields are not indexed, thus you will not be able to query things with these fields.
- The custom field name cannot start with "_". The field starting with "_" will be ignored and not stored.
- 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
{
"_vendorThingID": "[string]",
"_thingType": "[string]",
"_vendor": "[string]",
"_firmwareVersion": "[string]",
"_productName": "[string]",
"_lot": "[string]",
"_password": "[string]",
"_stringField1": "[string]",
"_stringField2": "[string]",
"_stringField3": "[string]",
"_stringField4": "[string]",
"_stringField5": "[string]",
"_numberField1": "[long]",
"_numberField2": "[long]",
"_numberField3": "[long]",
"_numberField4": "[long]",
"_numberField5": "[long]",
"_persistentToken": "[boolean]"
}
Content-Type application/vnd.kii.ThingRegistrationAndAuthorizationResponse+json
Name | Type | Description |
---|---|---|
Location | string | The URI of the registered thing. |
Name | Type | Description |
---|---|---|
_thingID | string | The identifier of the thing generated by Kii Cloud. |
_vendorThingID | string | The provided identifier of the thing. |
_thingType | string | The type of the thing. |
_vendor | string | The vendor of the thing. |
_firmwareVersion | string | The firmware version of the thing. |
_productName | string | The product name. |
_lot | string | The production lot. |
_created | long | The creation date of the thing in UNIX epoch format (msec in UTC). |
_stringField1 | string | The field for storing arbitrary string data. |
_stringField2 | string | The field for storing arbitrary string data. |
_stringField3 | string | The field for storing arbitrary string data. |
_stringField4 | string | The field for storing arbitrary string data. |
_stringField5 | string | The field for storing arbitrary string data. |
_numberField1 | long | The field for storing arbitrary numeric data. |
_numberField2 | long | The field for storing arbitrary numeric data. |
_numberField3 | long | The field for storing arbitrary numeric data. |
_numberField4 | long | The field for storing arbitrary numeric data. |
_numberField5 | long | The field for storing arbitrary numeric data. |
_accessToken | string | The access token of the thing |
_refreshToken | string | The refresh token for the obtained access token. The refresh token will not be provided when the token has been obtained with "_persistentToken=true". |
Content-Type application/vnd.kii.ThingAlreadyExistsException+json
Name | Type | Description |
---|---|---|
errorCode | string | Error code "THING_ALREADY_EXISTS". |
message | string | The error message. |
field | string | The field used for checking the duplication. It can be "thingID" or "vendorThingID". |
value | string | The value of the field. |
Content-Type application/vnd.kii.ValidationException+json
- A mandatory field is not provided in the request
- The value of a thing field is invalid
- The custom fields exceed the maximum allowed size
Name | Type | Description |
---|---|---|
errorCode | string | Error code "INVALID_INPUT_DATA". |
message | string | The error message. |