# Get Data
# The Raw Data

This endpoint retrieves the raw data of the device that the API token owner has access and supported measurement sets of devices.
# HTTP Request
GET {url}/data/raw?startTime={startTime}&endTime={endTime}&deviceId={device_ids}¶ms={params}
# Request Headers
| Key | Value |
|---|---|
| x-language | en |
| Authorization | Bearer {YOUR_API_TOKEN_HERE} |
# Request Params
| Parameter | Required | Type | Description |
|---|---|---|---|
| startTime | YES | datetime | Initial DateTime (UTC) for collecting the data |
| endTime | NO | datetime | Final DateTime (UTC) for collecting the data. The maximum allowed time interval is 30 days |
| deviceId | YES | String | Devices ID |
| params | YES | Array of String | Array of tag code (XXXXX). The tag code could be specified more than 1 parameters by comma (,) |
TIP
The parameters of the device depends on device type and device model. Please see detail in IoT Data Dictionary.
# Response
When successfully redirect to the assigned redirect_uri or posts according to the form with the parameters below attached.
| Parameter | Type | Description |
|---|---|---|
| deviceId | String | Devices ID |
| deviceName | String | Device name (XXXXXYYYZZZZ) |
| deviceType | String | Device type (YYY) |
| siteId | String | Site ID |
| count | Number | The count of the raw data in the requested period time. |
| data.DCOST | Number | Modbus's status code. |
| data.publishTimestamp | datetime | The UTC datetime of the publish timestamp from the device |
| data.params | double | The tag code or parameter's values as requested |
{
"data": {
"deviceId": "60d42638d9cd632d3cc01660",
"deviceName": "DEVICE_NAME",
"deviceType": "DEVICE_TYPE",
"siteId": "60d42357d9cd632d3cc01654",
"count": 2,
"data": [
{
"DCOST": 0,
"publishTimestamp": "2021-08-28T00:20:00.000Z",
"PACTO": 0.979478698730469,
"ENETO": 12089.609375
},
...
]
}
}
Example
As the response above, we have got active power (PACTO) and total energy (ENETO) on the local timestamp "2021-08-28T07:20:00.000Z" of the device "DEVICE_NAME"
# The Lasted Data
This endpoint retrieves the lasted data of the device that the API token owner has access.
# HTTP Request
GET {url}/data/latest?deviceId={device_ids}¶ms={params}
# Request Headers
| Key | Value |
|---|---|
| x-language | en |
| Authorization | Bearer {YOUR_API_TOKEN_HERE} |
# Request Params
| Parameter | Required | Type | Description |
|---|---|---|---|
| deviceIds | YES | Array of String | Array of Devices ID The device ID could be specified more than 1 device by comma (,) |
| params | YES | Array of String | Array of tag code (XXXXX). The tag code could be specified more than 1 parameters by comma (,) |
TIP
The parameters of the device depends on device type and device model. Please see detail in IoT Data Dictionary.
# Response
When successfully redirect to the assigned redirect_uri or posts according to the form with the parameters below attached.
| Parameter | Type | Description |
|---|---|---|
| deviceId | String | Devices ID |
| lastDataAt | datetime | The UTC datetime of the lasted data. |
| params | double | The tag code or parameter's values as requested |
{
"data": {
"lastest": [
{
"deviceId": "60d42620d9cd632d3cc0165f",
"lastDataAt": "2021-08-28T10:15:00.000Z",
"VPHSA": 230.02,
"PACTO": 1.155,
"ENETO": 2751.3798828125
},
{
"deviceId": "60d42638d9cd632d3cc01660",
"lastDataAt": "2021-08-28T10:15:00.000Z",
"VPHSA": 227.152297973633,
"PACTO": 16.610076171875,
"ENETO": 12214.9189453125
}
]
}
}
Example
As the response above, we have got the lasted voltage phase A (VPHSA),the active power (PACTO) and the total energy (ENETO) on the local timestamp "2021-08-28T17:15:00.000Z" of the device "DEVICE_NAME1" and "DEVICE_NAME2".
# The Average Data 15 Minutes

This endpoint retrieves the average data 15 Minutes of the device that the API token owner has access and supported measurement sets of devices.
# HTTP Request
GET {url}/data/average/quarter?startTime={startTime}&endTime={endTime}&deviceIds={device_ids}¶ms={params}
# Request Headers
| Key | Value |
|---|---|
| x-language | en |
| Authorization | Bearer {YOUR_API_TOKEN_HERE} |
# Request Params
| Parameter | Required | Type | Description |
|---|---|---|---|
| startTime | YES | datetime | Initial DateTime (UTC) for collecting the data |
| endTime | NO | datetime | Final DateTime (UTC) for collecting the data. The maximum allowed time interval is 30 days |
| deviceId | YES | String | Devices ID |
| params | YES | Array of String | Array of tag code (XXXXX). The tag code could be specified more than 1 parameters by comma (,) |
| merge | NO | Number | If you need to average per 15 minutes from all devices, please specified 1 |
# Response
When successfully redirect to the assigned redirect_uri or posts according to the form with the parameters below attached.
| Parameter | Type | Description |
|---|---|---|
| count | Number | The count of the raw data in the requested period time. |
| data.date | datetime | The UTC datetime of the publish timestamp (average 15 minutes) from the device or summarized devices |
| data.params | double | The tag code or Average value 15 minutes's parameters as requested |
{
"data": {
"count": 5,
"data": [
{
"PACTO": 1.4197777777777778,
"VLIAB": 402.3740740740741,
"VPHSA": 230.97407407407408,
"date": "2021-10-02T00:00:00.000Z",
"deviceId": "6131c0c9c9dc13b026d7bfc2"
},
...
]
}
}
# The Average Data 1 Hour

This endpoint retrieves the hourly average data of the device that the api token owner has access. Supported measurement sets of a device.
# HTTP Request
GET {url}/data/average/hour?startTime={startTime}&endTime={endTime}&deviceIds={device_ids}¶ms={params}
# Request headers
| KEY | VALUE |
|---|---|
| x-language | en |
| Authorization | Bearer {YOUR_API_TOKEN_HERE} |
# Request params
| Parameter | Required | Type | Description |
|---|---|---|---|
| startTime | YES | datetime | Initial DateTime (UTC) for collecting the data |
| endTime | NO | datetime | Final DateTime (UTC) for collecting the data. The maximum allowed time interval is 30 days. |
| deviceIds | YES | Array of String | Array of Devices's ids. The device's id could be specified more than 1 device by comma (,) |
| params | YES | Array of String | Array of tag code (XXXXX). The tag code could be specified more than 1 parameters by comma (,) |
| merge | NO | Number | If you need to average per 1 hour from all devices, please specified 1 |
TIP
The parameters of the device is depend on device type and device model. Please see detail in IoT Data Dictionary.
# Response
When successful, redirects to the assigned redirect_uri or posts according to the form with the parameters below attached.
| Parameter | Type | Description |
|---|---|---|
| count | Number | The count of the raw data in the requested period time. |
| deviceId | String | Devices's id. |
| data.date | datetime | UTC datetime of the publish timestamp (average 1 hour) from the device or summarized devices |
| data.params | double | the tag code or parameter's values as requested |
{
"data": {
"average": [
{
"HUDTY": 60.4462037037037,
"ABTMP": 34.60592592592592,
"date": "2021-10-01T07:00:00.000Z",
"deviceId": "612c849389362868151f62c5"
},
{
"HUDTY": 54.03916666666667,
"ABTMP": 36.954166666666666,
"date": "2021-10-01T08:00:00.000Z",
"deviceId": "612c849389362868151f62c5"
},
...
]
}
}
Example
As the response above, we got the hourly average humidity (HUDTY) and ambient temperature (ABTMP) of the device "DEVICE_NAME" in local timestamp "2021-10-01T14:00:00.000Z".
# The Average Data Daily

This endpoint retrieves the daily average data of the device that the api token owner has access. Supported measurement sets of a device.
# HTTP Request
GET {url}/data/average/daily?startTime={startTime}&endTime={endTime}&deviceIds={device_ids}¶ms={params}
# Request headers
| KEY | VALUE |
|---|---|
| x-language | en |
| Authorization | Bearer {YOUR_API_TOKEN_HERE} |
# Request params
| Parameter | Required | Type | Description |
|---|---|---|---|
| startTime | YES | datetime | Initial DateTime (UTC) for collecting the data |
| endTime | NO | datetime | Final DateTime (UTC) for collecting the data. The maximum allowed time interval is 30 days. |
| deviceIds | YES | Array of String | Array of Devices's ids. The device's id could be specified more than 1 device by comma (,) |
| params | YES | Array of String | Array of tag code (XXXXX). The tag code could be specified more than 1 parameters by comma (,) |
| merge | NO | Number | If you need to average per 1 hour from all devices, please specified 1 |
TIP
The parameters of the device is depend on device type and device model. Please see detail in IoT Data Dictionary.
# Response
When successful, redirects to the assigned redirect_uri or posts according to the form with the parameters below attached.
| Parameter | Type | Description |
|---|---|---|
| count | Number | The count of the raw data in the requested period time. |
| deviceId | String | Devices's id. |
| data.date | datetime | UTC datetime of the publish timestamp (average 1 daily) from the device or summarized devices |
| data.params | double | the tag code or parameter's values as requested |
{
"data": {
"average": [
{
"WISPE": 8.528472222222222,
"date": "2023-09-11T17:00:00.000Z",
"deviceId": "62fb8949495e487987410fa1"
},
{
"WISPE": 7.8812500000000005,
"date": "2023-09-12T17:00:00.000Z",
"deviceId": "62fb8949495e487987410fa1"
}
]
}
}
Example
As the response above, we got the hourly average wind speed (WISPE) of the device "DEVICE_NAME" in local date "2023-09-12" and "2023-09-13".
# The Summary Data 15 Minutes

This endpoint retrieves the summary data 15 Minutes of the device that the API token owner has access and supported measurement sets of devices.
# HTTP Request
GET {url}/data/sum/quarter?startTime={startTime}&endTime={endTime}&deviceIds={device_ids}¶ms={params}
# Request Headers
| Key | Value |
|---|---|
| x-language | en |
| Authorization | Bearer {YOUR_API_TOKEN_HERE} |
# Request Params
| Parameter | Required | Type | Description |
|---|---|---|---|
| startTime | YES | datetime | Initial DateTime (UTC) for collecting the data |
| endTime | NO | datetime | Final DateTime (UTC) for collecting the data. The maximum allowed time interval is 30 days |
| deviceId | YES | String | Devices ID |
| params | YES | Array of String | Array of tag code (XXXXX). The tag code could be specified more than 1 parameters by comma (,) |
| merge | NO | Number | If you need to summarized per 15 minutes from all devices, please specified 1 |
# Response
When successfully redirect to the assigned redirect_uri or posts according to the form with the parameters below attached.
| Parameter | Type | Description |
|---|---|---|
| count | Number | The count of the raw data in the requested period time. |
| data.date | datetime | The UTC datetime of the publish timestamp (average 15 minutes) from the device or summarized devices |
| data.params | double | The tag code or summarized value 15 minutes's parameters as requested |
{
"data": {
"sum": [
{
"RAINF": 105.56,
"date": "2021-10-01T07:00:00.000Z",
"deviceId": "612c849389362868151f62c5"
},
s...
]
}
}
Example
As the response above, we got the summary rainfall (RAINF) 15 Minutes of the device "DEVICE_NAME" in local timestamp "2021-10-01T14:00:00.000Z".
# The Summary Data 1 Hour

This endpoint retrieves the hourly summary data of the device that the api token owner has access. Supported measurement sets of a device.
# HTTP Request
GET {url}/data/sum/hour?startTime={startTime}&endTime={endTime}&deviceIds={device_ids}¶ms={params}
# Request Headers
| Key | Value |
|---|---|
| x-language | en |
| Authorization | Bearer {YOUR_API_TOKEN_HERE} |
# Request Params
| Parameter | Required | Type | Description |
|---|---|---|---|
| startTime | YES | datetime | Initial DateTime (UTC) for collecting the data |
| endTime | NO | datetime | Final DateTime (UTC) for collecting the data. The maximum allowed time interval is 30 days |
| deviceId | YES | String | Devices ID |
| params | YES | Array of String | Array of tag code (XXXXX). The tag code could be specified more than 1 parameters by comma (,) |
| merge | NO | Number | If you need to summarized per 1 hour from all devices, please specified 1 |
# Response
When successfully redirect to the assigned redirect_uri or posts according to the form with the parameters below attached.
| Parameter | Type | Description |
|---|---|---|
| count | Number | The count of the raw data in the requested period time. |
| data.date | datetime | The UTC datetime of the publish timestamp (average 15 minutes) from the device or summarized devices |
| data.params | double | The tag code or summarized value 1 hour's parameters as requested |
{
"data": {
"sum": [
{
"RAINF": 415.271111111111,
"date": "2021-10-01T07:00:00.000Z",
"deviceId": "612c849389362868151f62c5"
},
...
]
}
}
Example
As the response above, we got the hourly rainfall (RAINF) of the device "DEVICE_NAME" in local timestamp "2021-10-01T14:00:00.000Z".
# The Thailand Public Holidays
The Thailand Public Holidays are depend on MEA and PEA confirmation that day is off-peak day which affect to TOU rate.
# HTTP Request
`GET {url}/holiday?startTime={startTime}&endTime={endTime}
# Request Headers
| Key | Value |
|---|---|
| x-language | en |
| Authorization | Bearer {YOUR_API_TOKEN_HERE} |
# Request Params
| Parameter | Required | Type | Description |
|---|---|---|---|
| startTime | YES | datetime | Initial DateTime (UTC) for your period |
| endTime | NO | datetime | Final DateTime (UTC) for your period |
# Response
When successfully redirect to the assigned redirect_uri or posts according to the form with the parameters below attached.
| Parameter | Type | Description |
|---|---|---|
| count | Number | The count of the raw data in the requested period time. |
| data.date | datetime | The UTC datetime of the publish timestamp (average 15 minutes) from the device or summarized devices |
| data.params | double | The tag code or summarized value 1 hour's parameters as requested |
{
"data": {
"holiday": [
{
"date": "2023-03-05T17:00:00.000Z",
"description": "วันมาฆบูชา"
},
{
"date": "2023-04-05T17:00:00.000Z",
"description": "วันพระบาทสมเด็จพระพุทธยอดฟ้าจุฬาโลกมหาราช และวันที่ระลึกมหาจักรีบรมราชวงศ์"
},
{
"date": "2023-04-12T17:00:00.000Z",
"description": "วันสงกรานต์"
}
]
}
}
Example
As the response above, we got the holiday "วันมาฆบูชา" in local timestamp "2023-03-06".