How can we help?

Searching:

0 results found

Schema Definitions/ Parse

/odata/schemaDefinitions/Parse
 

Description

The parse action enables you to test your schema correctness with a specific payload. In response, you can retrieve the Axonize event that was created, or send the event to the actual device if it exists.
 

Parse
Property Type Description Mandatory
schemaDefinition Schema Definition Object The schema definition as described above
deviceId String The device ID No
Productid String The device product ID
Payload String The Json payload
sendToHub Boolean Send the parsed event to IoT Hub – will work if there is a valid device.

 

Example JSON – parse

curl ‘https://api.axonize.com/odata/schemaDefinitions/Parse’ -H ‘Authorization: your token’ -H ‘Content-Type: application/json;charset=UTF-8’ -H ‘appId: your app id’  –data-binary ‘{“schemaDefinition”:{“name”:”cidds9″,”parserType”:”JsonParser”,”id”:”5df88b80e3b0cd1a805030d4″,”appId”:”your app id”,”createDate”:”2019-12-17T08:02:08.419Z”,”createUser”:”1234″,”updateDate”:”2019-12-17T08:02:08.419Z”,”updateUser”:”1234″,”schema”:[{“attributePath”:”sensor_serial”,”actionType”:”CustomId”,”convertInfo”:{“functionType”:null,”parameters”:[],”customFunction”:null},”convertPipeline”:[],”event”:null,”patch”:null},{“attributePath”:”thetime”,”actionType”:”Datetime”,”convertInfo”:{“functionType”:null,”parameters”:[],”customFunction”:null},”convertPipeline”:[],”event”:null,”patch”:null},{“attributePath”:”temperature”,”actionType”:”Event”,”convertInfo”:null,”convertPipeline”:[],”event”:{“name”:”Temperature”,”typeCode”:7,”unit”:”C”},”patch”:null},{“attributePath”:”humidity”,”actionType”:”Event”,”convertInfo”:{“functionType”:”hexToDec”,”parameters”:[],”customFunction”:null},”convertPipeline”:[],”event”:{“name”:”Humidity”,”typeCode”:8,”unit”:”%”},”patch”:null},{“attributePath”:”co2″,”actionType”:”Event”,”convertInfo”:null,”convertPipeline”:[],”event”:{“name”:”CO2″,”typeCode”:1008,”unit”:”ppm”},”patch”:null}],”options”:null,”jsonSample”:{“content”:”{\”sensor_serial\”:\”123124\”,\”thetime\”:\”2019-11-14T11:20:50.52Z\”,\”temperature\”:22,\”humidity\”:45,\”co2\”:1500}”,”name”:”Product temperature.json”,”updateDate”:”2019-12-17T07:56:45.983Z”}},”productId”:”5df88a02e3b0cc1864491234″,”payload”:”{\”sensor_serial\”:\”123124\”,\”thetime\”:\”2019-11-14T11:20:50.52Z\”,\”temperature\”:22,\”humidity\”:45,\”co2\”:1500}”,”sendToHub”:false}’ –compressed

 

JSON response –

Status 200 – ok

{“@odata.context”:”https://10.10.2.103/odata/$metadata#Edm.String”,”value”:”[{\”app_id\”:\”607bebf7-84bd-4ab9-be55-51b2d5e255e4\”,\”product_id\”:\”5d4be80ae3b0c719946b9275\”,\”device_id\”:\”5cf7df56e3b0cd3dd06ed533\”,\”dateTime\”:\”2019-12-19T13:03:02.189Z\”,\”type\”:7,\”name\”:\”Temperature\”,\”value\”:34}]”}