ThingWorx Model Definition and Composer > Things > Thing Properties > Programmatically Adding Properties to Things
  
Programmatically Adding Properties to Things
The AddPropertyDefinition service can be used to create a new local or remote-bound property on a thing, thing template, or thing shape. The service has the following parameters:
Parameter
Base Type
Description
name
STRING
Required. The name of the property to create.
type
BASETYPENAME
Required. Data type of the property.
description
STRING
Description of the property.
category
STRING
Category name to classify the property.
dataShape
DATASHAPENAME
When the property type is INFOTABLE, defines the data shape used by the property.
The data shape entity specified for this parameter must exist before the service is run.
This parameter is not required; however, the INFOTABLE will not be able to be set through Composer (using Set button) without a data shape specified.
defaultValue
STRING
Specifies the default value for the property.
readOnly
BOOLEAN
True if the property is read-only, otherwise false.
persistent
BOOLEAN
True if values will persist over a restart of the ThingWorx service (values are stored in the Persistence Provider), false if the value is cleared on restart of the ThingWorx service.
logged
BOOLEAN
If true, the property is stored in a configured value stream.
dataChangeType
STRING
Defines what constitutes a change in the value of the property for logging/alert purposes. One of Always, Never, On, Off, or Value.
Always: Fire a change event for any property value change.
Never: Never fire a change event on a property value change.
On: For most values, any change to the property will fire a data changed event.
Off: Fires a data changed event if the new value evaluates to a boolean false.
Value: For number types (NUMBER, INTEGER, LONG, etc), a change event is fired if the difference between the old and new property value exceeds the threshold specified in the dataChangeThreshold parameter.
dataChangeThreshold
NUMBER
The minimum amount that a numeric-typed property must change by before a data change event is fired.
Remote Properties
There are additional parameters for remote-bound properties.
* 
These properties do not need to be specified unless the property being defined is being bound to a remote property.
Parameter
Base Type
Description
remote
BOOLEAN
True if the property is bound to a remote property, false if not. (Default false)
remotePropertyName
STRING
The name of the property on the remote thing to bind to.
timeout
INTEGER
The amount of time in seconds to wait for a response from the remote thing.
* 
Setting this value to 0 will use the system default.
pushType
STRING
How are values pushed from the remote device. Set to ALWAYS, NEVER, ON, OFF, or VALUE, with definitions similar to dataChangeType above.
pushThreshold
NUMBER
Defines the threshold that a numeric type property must exceed before a data change is pushed to the remote device.