Try   HackMD

Sensor Data Delivery API

1.Registration

Method:POST
URL

https://192.168.0.01:1000/registration

Parameter
|Name|Type|Example|
|-|-|-|-|
|credential_pass|String|QWERTY|

Response

{
    "id": "1_QWAS" // QWAS is generate by random
    "time": "01-02-2006 15:04:05"
}

2.Question

Method:GET
URL

https://192.168.0.01:1000/question/1_QWAS

Parameter
|Name|Type|Example|
|-|-|-|-|
|id|String|1_QWAS|

Response

{
    "status": "on" // or off
}

3.Send Data

Method:POST
URL

https://192.168.0.01:1000/data/1_QWAS

POST Body
|Input|Type|Example|
|-|-|-|-|
|id|String|1_QWAS|
|sensor|String|Heat|
|value|String|23.05|
|time|String|01-02-2006 15:04:05|

Response

{
    "message" : "The data client with ID 1QWAS has been added successfully"
}

4. Reset

Method:GET
URL

https://192.168.0.01:1000/reset/1_QWAS

POST Body
|Input|Type|Example|
|-|-|-|-|
|id|String|1_QWAS|

Response

{
    "message" : "The client with ID 1QWAS has been deleted successfully"
}

5. Synchronization

Method:GET
URL

https://192.168.0.01:1000/sync/1_QWAS

Parameter
|Name|Type|Example|
|-|-|-|-|
|id|String|1_QWAS|
Response

{
    "time" : "01-02-2006 15:04:05"
    "total" : "1"
}

6. History

Method:GET
URL

https://192.168.0.01:1000/history/1_QWAS/1

Parameter
|Name|Type|Example|
|-|-|-|-|
|id|String|1_QWAS|
|n|String|1|
Response

{
    "sensor" : "Heat"
    "value" : "23.05"
    "time" : "01-02-2006 15:04:05"
}