By registering a thing, it will be acknowledged by Kii Cloud.
Upon the thing registration, you can set various attributes as the the thing information field values (See Thing Management for the explanation of each field).
The following sample code blocks are examples of registering a thing with its vendorThingID "rBnvSPOXBDF9r29GJeGS", its type "sensor", its vendor name "Kii" and the password "123ABC".
Android
iOS
Swift:
Objective-C:
JavaScript
// Set thing information.varthingFields={_vendorThingID:"rBnvSPOXBDF9r29GJeGS",_password:"123ABC",_thingType:"sensor",_vendor:"Kii"};// Register the thing.KiiThing.register(thingFields,{success:function(thing){// Get the current user.varuser=KiiUser.getCurrentUser();// Register the current user as the thing owner.thing.registerOwner(user,{success:function(thing,user){// Do something.},failure:function(error){// Handle the error.}});},failure:function(error){// Handle the error.}});
The basic steps are as follows:
Set the thing attributes in the thing information fields as needed (See here to see how you can set the attributes).
Register the thing with the vendorThingID and the password.
Register the current user as the thing owner. See Registering Owners for more details on the thing owner registration.
Hint for Creating a Thing List
If you need to get a list of things, you need to implement the feature in your application. For example, your application can use a dedicated application scope bucket to store information of all things. See Hint for creating a user list (Android) to learn how you can implement it.