Scenario:
- Creating a "thermometer" thing with a float property "temperature"
- Using the UI or API to get current temperature value (read), or set a new value (write)
Steps:
For a complete description of all the settings used for the dialog boxes in this tutorial, see Thing Settings and Thing Property Settings.
1. Create "thermometer" thing
- In the "Things" tab, open "Create Thing" dialog
- Set name of the thing
- Click "Save" button
A new "Thermometer" thing is added to the list in the "Things" tab. Clicking it will open the "Thing: Thermometer" tab
2. Create "temperature" property
- In the "Thing: Thermometer" tab, open "Property"
- Click to open "Create Property" dialog
- Set name of the property
- Select "persistent" as the property type (property value would be persisted by the GK)
- Select "float" as the data type for this property
- Save property
The property is added to the list, and its details are shown in the pane below it
3. Get/set property value using UI
- In the "Properties" section of "Thing: Thermometer", select "temperature"
- Click "Edit Value" button to open "Property value" dialog
- The current property value is shown here
- Click "Generate value" to generate a random value in the "Value" text area
- Click "Set" to retain the value in persistent memory
- Click "Get" to get the current property value
4. Get/set property value using REST API
- Check out the GadgetKeeper API - Thing Properties page for details on how to perform basic method operations on GadgetKeeper API using cURL or a REST API tool
- Obtain required parameters:
- Use API Explorer to perform REST calls using UI
- Use cURL to perform REST calls using command lines:
To get property value:
To set property value: