Searching:
0 results foundDevices/createVirtualDevice
POST /odata/Devices/createVirtualDevice
Description
Creates a new virtual device.
See the following for request and response details ‒
See Also
Request ‒ Devices/createVirtualDevice
Property | Type | Description | Mandatory |
productId | String | The unique identifier of the Product to which this Device belongs. This ID is returned in response to the Products/Post request. | Y |
name | String | The name of this Device. | Y |
serialNumber | String | The serial number of this Device. | |
events | String | Copy in here the actual XML text. See Defining a Virtual Device Manifest for more details. |
Example JSON Devices/createVirtualDevice
curl -X POST \
https://api.stg.axonize.com/odata/devices/createVirtualDevice \
-H ‘Cache-Control: no-cache’ \
-H ‘Content-Type: application/json’ \
-H ‘Authorization: Token’ \
-H ‘appId: be517433-c4b8-4748-9258-1b1234567890’ \
-d ‘{“virtualDevice”:{“productId”:”58766044391802681471830f”,”name”:”shachartest”,”serialNumber”:”123231″,”events”:”<Events>\n\t<Event>\n\t\t<Id>7</Id>\n\t\t<Name>Temperature</Name>\n\t\t<MinValue>10</MinValue>\n\t\t<MaxValue>30</MaxValue>\n\t\t<SecondsInterval>300</SecondsInterval>\n\t\t<ValueType>Decimal</ValueType>\n\t\t<DecimalPoints>2</DecimalPoints>\n\t</Event>\n</Events>”}}’
Response ‒ Devices/createVirtualDevice
All the same properties in the request are returned in the response. In addition, the response that is returned also contains the following properties –
Property | Type | Description |
deviceId | String | A unique identifier that is automatically generated for this Device by Axonize. |
appId | String | The Application to which this Device belongs.
This generated by Axonize and sent in the response to Applications/Post. |
createDate, createUser, updateDate, updateUser |
See Common Response Properties. |
Example JSON Devices/createVirtualDevice
{
“@odata.context” : “https://stg-axonizeapi-axonize.stgse-axonize.p.azurewebsites.net/odata/$metadata#Device/$entity”,
“productId” : “587660443918026814711234”,
“productName” : null,
“serialNumber” : “123231”,
“topic” : null,
“groupId” : null,
“active” : false,
“firstTimeRegistrationDate” : “0001-01-01T00:00:00Z”,
“activationDate” : “0001-01-01T00:00:00Z”,
“token” : null,
“commandsProtocol” : “Undefined”,
“lastReadingTime” : “0001-01-01T00:00:00Z”,
“isConnected” : false,
“hubId” : null,
“hubPrimaryKey” : “cH1pQfeZeM”,
“hubSecondaryKey” : “aIE/hXY”,
“customId” : null,
“keepAliveThreshold” : 0,
“isAlarmed” : false,
“virtualDeviceStatus” : “Started”,
“virtualDeviceEvents” : “<Events>\n\t<Event>\n\t\t<Id>7</Id>\n\t\t<Name>Temperature</Name>\n\t\t<MinValue>10</MinValue>\n\t\t<MaxValue>30</MaxValue>\n\t\t<SecondsInterval>300</SecondsInterval>\n\t\t<ValueType>Decimal</ValueType>\n\t\t<DecimalPoints>2</DecimalPoints>\n\t</Event>\n</Events>”,
“redisKey” : null,
“diagram” : null,
“streamUrl” : null,
“parentId” : null,
“name” : “shachartest”,
“id” : “5bc5d1bb19ec0c40b07f1234”,
“appId” : “f51df5bf-8d3c-4ba5-9574-3f3b8d6a26bd”,
“createDate” : “2018-10-16T11:55:39.1418009Z”,
“createUser” : “58845d47922dcf2b0cc41234”,
“updateDate” : “0001-01-01T00:00:00Z”,
“updateUser” : null,
“lastReadings” : [],
“additionalProperties” : [],
“userDefinedLocation” : null,
“currentLocation” : null,
“coords” : null,
“settings” : [],
“ancestors” : []
}