Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Machlake는 입력된 센서 tag데이터들을 자동으로 tag별, 시간별로 통계 데이터를 생성한다. 이렇게 생성한 통계데이터는 이 API를 통해서 검색할 수 있다. 이 API를 이용하면 대량의 센서 데이터를 연, 월, 일간 단위로 통계값을 얻어서 빠르게 차트를 생성하는 등의 연산이 가능하다. 이 API로 조회할 수 있는,

자동으로 생성되는 통계데이터는 각 tag별 Min, Max, Sum, Count, Average이다.

...

Optional

Type

Description

Example

direction

int

ascend or descent by time오름차순 혹은 내림차순 설정

&direction=0
0 : ascend (default)
1 : descend

limit

int

count of display출력할 데이터의 수

&limit=1000 (default : Limited according to Lake tier)

offset

int

count of skip검색후 건너뛸 데이터의 수

&offset=500

date_format

string

date format of select time
or
timestamp type Time값의 포멧 지정 DATE_FORMAT 혹은 timestamp 단위("SECOND", "MILLISECOND", "MICROSECOND", "NANOSECOND")

&date_format=YYYY-MM-DD HH24:MI:SS
or
&date_format=MILLISECOND

(default : YYYY-MM-DD HH24:MI:SS)

interval_value

int

duration valueinterval_type에서 지정된 단위의 배수. interval_type이 min이고 interval_value가 3이면 3분마다 결과를 출력

&interval_value=10 (default : 1)

end_time

string

end time of select  (MUST be more than start_time!검색 종료 시간 (start_time보다 커야 함)

same as start_time

same as start_time

calc_mode

string

min,max,cnt,avg,sum

&calc_mode=min (default : avg)

value_return_form

int

result set format

Optimized for various chart libraries and configured to return결과 출력 방법


차트 라이브러리에서 입력받는 방식에 따라 변경하여 사용함

0 : separate standard (default)

1 : merged standard

interval_type

string

sec,min,hour,day (or s,m,h,d)

&interval_type=hour (default : sec)

separator

string

separator for 매개변수의 tag_name, columns, and_conditioncondition들을 구분하는 구분자

&separator=| (default : ,)

start_time

string

start time of select (MUST be less than end_time!)

type 1 : time string format검색 시작 시간 (종료시간보다 적은 값이어야 함)

아래의 두가지 중 하나의 방법으로 설정

type 1 : 시간 문자열

start_time=2018-01-16 14:40:05 000
or

start_time=2018-01-16 14:40:05.000

type 2 : timestamp (second or millisecond)2 : 밀리초 혹은 마이크로초 기반 타임스탬프

start_time=1618813188
or

start_time=1618813188123

&start_time=2018-01-16 14:40:05 000
or
&start_time=2018-01-16 14:40:05.000
or
&start_time=1618813188
or
&start_time=1618813188123

  • datetime of parameter supports up to millisecond.

tag_name

string

tag name with , separatorTag의 이름. 여러개를 명시하려면 ',' 문자를 이용하여 나열할 수 있다.

&tag_name=tag1,tag2,tag3

Request Example

...

Code Block
Status 200
 
// return format = 0
{
    "status": "success",
    "data": {
        "calc_mode": "AVG",
        "columns": [
            {"name": "TIME", "type": 5, "length": 4096},
            {"name": "VALUE", "type": 20, "length": 17}
        ],
        "samples": [
            {
                "tag_name": "tag_02",
                "data": [
                    {"TIME": "2021-06-16 11:36:00", "VALUE": 1524.3684},
                    {"TIME": "2021-06-16 11:37:00", "VALUE": 1490.107},
                    {"TIME": "2021-06-17 15:44:00", "VALUE": 1508.5176},
                    {"TIME": "2021-07-06 12:12:00", "VALUE": 1628}
                ]
            },
            {
                "tag_name": "tag_01",
                "data": [
                    {"TIME": "2021-06-16 11:36:00", "VALUE": 1515.4806},
                    {"TIME": "2021-06-16 11:37:00", "VALUE": 1513.4624},
                    {"TIME": "2021-06-17 15:42:00", "VALUE": 1499.0289},
                    {"TIME": "2021-06-17 15:43:00", "VALUE": 1470.2225},
                    {"TIME": "2021-06-17 15:44:00", "VALUE": 1487.0528},
                    {"TIME": "2021-07-06 12:12:00", "VALUE": 1887.5}
                ]
            }
        ]
    }
}
 
// return format = 1
{
    "status": "success",
    "data": {
        "calc_mode": "AVG",
        "columns": [
            {"name": "TIME", "type": 5, "length": 4096},
            {"name": "VALUE", "type": 20, "length": 17}
        ],
        "samples": [
            {
                "tag_name": "tag_02",
                "data": {
                    "TIME": [
                        "2021-06-16 11:36:00",
                        "2021-06-16 11:37:00",
                        "2021-06-17 15:44:00",
                        "2021-07-06 12:12:00"
                    ],
                    "VALUE": [
                        1524.3684,
                        1490.107,
                        1508.5176,
                        1628
                    ]
                }
            },
            {
                "tag_name": "tag_01",
                "data": {
                    "TIME": [
                        "2021-06-16 11:36:00",
                        "2021-06-16 11:37:00",
                        "2021-06-17 15:42:00",
                        "2021-06-17 15:43:00",
                        "2021-06-17 15:44:00",
                        "2021-07-06 12:12:00"
                    ],
                    "VALUE": [
                        1515.4806,
                        1513.4624,
                        1499.0289,
                        1470.2225,
                        1487.0528,
                        1887.5
                    ]
                }
            }
        ]
    }
}

Sample Code

Also this API has lots of parameters, but sample case contain few case, but should combine variety parameter combination from these example

Expand
titlewindow(batch)

github

Code Block
chcp 65001 
:: Text Encoding to UTF-8 in CMD
:: Example For Select Calculated Data for tag API by using curl in window script
:: written by yeony kim

set API_KEY=YOUR_API_TOKEN

set CONTENT_HEADER="Content-Type: application/json"
set API_HEADER="x-api-key: %API_KEY%"
set LAKE_ID=YOUR_LAKE_ID
set URL="https://%LAKE_ID%.machlake.com/lakes/values/calculated"

:: ------------------------------------------------------------------------------------------------- ::

:: CASE - Calculated DATA GET with date format YYYY-MM-DD HH24:MI:SS mmm:uuu:nnn with calc_mode=min
set TAG_NAME=sensor1,sensor2
set CALC_MODE=min
set DATE_FORMAT=YYYY-MM-DD HH24:MI:SS mmm:uuu:nnn
set START_TIME=2021-01-06 17:00:00 000:000:000
set END_TIME=2021-01-06 21:00:00 000:000:000

curl -k -G %URL% -H %CONTENT_HEADER% -H %API_HEADER% --data-urlencode "tag_name=%TAG_NAME%" --data-urlencode "calc_mode=%CALC_MODE%" --data-urlencode "start_time=%START_TIME%" --data-urlencode "end_time=%END_TIME%" --data-urlencode "date_format=%DATE_FORMAT%"

:: Return Format
:: {"data":{"calc_mode":"MIN","columns":[{"name":"TIME","type":5,"length":4096},{"name":"VALUE","type":20,"length":17}],"samples":[{"tag_name":"sensor1","data":[{"TIME":"2021-01-06 17:00:00 000:000:000","VALUE":1},{"TIME":"2021-01-06 18:00:00 000:000:000","VALUE":2},{"TIME":"2021-01-06 20:00:04 000:000:000","VALUE":2},{"TIME":"2021-01-06 20:00:05 000:000:000","VALUE":2.5},{"TIME":"2021-01-06 20:00:06 000:000:000","VALUE":2}]},{"tag_name":"sensor2","data":[{"TIME":"2021-01-06 17:00:00 000:000:000","VALUE":1},{"TIME":"2021-01-06 17:00:01 000:000:000","VALUE":1.5},{"TIME":"2021-01-06 17:00:02 000:000:000","VALUE":2},{"TIME":"2021-01-06 17:00:03 000:000:000","VALUE":1},{"TIME":"2021-01-06 17:00:04 000:000:000","VALUE":1.5},{"TIME":"2021-01-06 17:00:05 000:000:000","VALUE":2},{"TIME":"2021-01-06 18:00:00 000:000:000","VALUE":2},{"TIME":"2021-01-06 20:00:04 000:000:000","VALUE":2},{"TIME":"2021-01-06 20:00:05 000:000:000","VALUE":2.5},{"TIME":"2021-01-06 20:00:06 000:000:000","VALUE":2}]}]},"status":"success"}

:: ------------------------------------------------------------------------------------------------- ::

:: CASE - Calculated DATA GET with date format YYYY-MM-DD HH24:MI:SS mmm:uuu:nnn with calc_mode=max and interval_value=3
set TAG_NAME=sensor1,sensor2
set CALC_MODE=max
set DATE_FORMAT=YYYY-MM-DD HH24:MI:SS mmm:uuu:nnn
set START_TIME=2021-01-06 17:00:00 000:000:000
set END_TIME=2021-01-06 21:00:00 000:000:000
set INTERVAL_VALUE=3

curl -k -G %URL% -H %CONTENT_HEADER% -H %API_HEADER% --data-urlencode "tag_name=%TAG_NAME%" --data-urlencode "calc_mode=%CALC_MODE%" --data-urlencode "start_time=%START_TIME%" --data-urlencode "end_time=%END_TIME%" --data-urlencode "date_format=%DATE_FORMAT%" --data-urlencode "interval_value=%INTERVAL_VALUE%"

:: Return Format
:: {"data":{"calc_mode":"MAX","columns":[{"name":"TIME","type":5,"length":4096},{"name":"VALUE","type":20,"length":17}],"samples":[{"tag_name":"sensor2","data":[{"TIME":"2021-01-06 17:00:00 000:000:000","VALUE":2},{"TIME":"2021-01-06 17:00:03 000:000:000","VALUE":2},{"TIME":"2021-01-06 18:00:00 000:000:000","VALUE":2.5},{"TIME":"2021-01-06 20:00:03 000:000:000","VALUE":2.5},{"TIME":"2021-01-06 20:00:06 000:000:000","VALUE":2}]},{"tag_name":"sensor1","data":[{"TIME":"2021-01-06 17:00:00 000:000:000","VALUE":2},{"TIME":"2021-01-06 18:00:00 000:000:000","VALUE":2.5},{"TIME":"2021-01-06 20:00:03 000:000:000","VALUE":2.5},{"TIME":"2021-01-06 20:00:06 000:000:000","VALUE":2}]}]},"status":"success"}

:: ------------------------------------------------------------------------------------------------- ::

:: CASE - Calculated DATA GET with date format YYYY-MM-DD HH24:MI:SS mmm:uuu:nnn with calc_mode=min and interval_type=m and interval_value=90
set TAG_NAME=sensor1,sensor2
set CALC_MODE=cnt
set DATE_FORMAT=YYYY-MM-DD HH24:MI:SS mmm:uuu:nnn
set START_TIME=2021-01-06 17:00:00 000:000:000
set END_TIME=2021-01-06 21:00:00 000:000:000
set INTERVAL_TYPE=m
set INTERVAL_VALUE=90

curl -k -G %URL% -H %CONTENT_HEADER% -H %API_HEADER% --data-urlencode "tag_name=%TAG_NAME%" --data-urlencode "calc_mode=%CALC_MODE%" --data-urlencode "start_time=%START_TIME%" --data-urlencode "end_time=%END_TIME%" --data-urlencode "date_format=%DATE_FORMAT%" --data-urlencode "interval_value=%INTERVAL_VALUE%" --data-urlencode "interval_type=%INTERVAL_TYPE%"

:: Return Format
:: {"data":{"calc_mode":"COUNT","columns":[{"name":"TIME","type":5,"length":4096},{"name":"VALUE","type":12,"length":20}],"samples":[{"tag_name":"sensor2","data":[{"TIME":"2021-01-06 16:30:00 000:000:000","VALUE":1},{"TIME":"2021-01-06 18:00:00 000:000:000","VALUE":1},{"TIME":"2021-01-06 19:30:00 000:000:000","VALUE":1}]},{"tag_name":"sensor1","data":[{"TIME":"2021-01-06 16:30:00 000:000:000","VALUE":1},{"TIME":"2021-01-06 18:00:00 000:000:000","VALUE":1},{"TIME":"2021-01-06 19:30:00 000:000:000","VALUE":1}]}]},"status":"success"}

:: ------------------------------------------------------------------------------------------------- ::
Expand
titlelinux(shell)

github

Code Block
# Text Encoding to UTF-8 in CMD
# Example For Select Calculated Data for tag API by using curl in ubuntu
# written by yeony kim

API_KEY=YOUR_API_TOKEN

CONTENT_HEADER=Content-Type:application/json
API_HEADER=x-api-key:$API_KEY
LAKE_ID=YOUR_LAKE_ID
URL="https://$LAKE_ID.machlake.com/lakes/values/calculated"

# ------------------------------------------------------------------------------------------------- #

# CASE - Calculated DATA GET with date format YYYY-MM-DD HH24:MI:SS mmm:uuu:nnn with calc_mode=min
TAG_NAME=sensor1,sensor2
CALC_MODE=min
DATE_FORMAT="YYYY-MM-DD HH24:MI:SS mmm:uuu:nnn"
START_TIME="2021-01-06 17:00:00 000:000:000"
END_TIME="2021-01-06 21:00:00 000:000:000"

curl -k -G $URL -H $CONTENT_HEADER -H $API_HEADER --data-urlencode "tag_name=$TAG_NAME" --data-urlencode "calc_mode=$CALC_MODE" --data-urlencode "start_time=$START_TIME" --data-urlencode "end_time=$END_TIME" --data-urlencode "date_format=$DATE_FORMAT"

# Return Format
# {"data":{"calc_mode":"MIN","columns":[{"name":"TIME","type":5,"length":4096},{"name":"VALUE","type":20,"length":17}],"samples":[{"tag_name":"sensor1","data":[{"TIME":"2021-01-06 17:00:00 000:000:000","VALUE":1},{"TIME":"2021-01-06 18:00:00 000:000:000","VALUE":2},{"TIME":"2021-01-06 20:00:04 000:000:000","VALUE":2},{"TIME":"2021-01-06 20:00:05 000:000:000","VALUE":2.5},{"TIME":"2021-01-06 20:00:06 000:000:000","VALUE":2}]},{"tag_name":"sensor2","data":[{"TIME":"2021-01-06 17:00:00 000:000:000","VALUE":1},{"TIME":"2021-01-06 17:00:01 000:000:000","VALUE":1.5},{"TIME":"2021-01-06 17:00:02 000:000:000","VALUE":2},{"TIME":"2021-01-06 17:00:03 000:000:000","VALUE":1},{"TIME":"2021-01-06 17:00:04 000:000:000","VALUE":1.5},{"TIME":"2021-01-06 17:00:05 000:000:000","VALUE":2},{"TIME":"2021-01-06 18:00:00 000:000:000","VALUE":2},{"TIME":"2021-01-06 20:00:04 000:000:000","VALUE":2},{"TIME":"2021-01-06 20:00:05 000:000:000","VALUE":2.5},{"TIME":"2021-01-06 20:00:06 000:000:000","VALUE":2}]}]},"status":"success"}

# ------------------------------------------------------------------------------------------------- #

# CASE - Calculated DATA GET with date format YYYY-MM-DD HH24:MI:SS mmm:uuu:nnn with calc_mode=max and interval_value=3
TAG_NAME=sensor1,sensor2
CALC_MODE=max
DATE_FORMAT="YYYY-MM-DD HH24:MI:SS mmm:uuu:nnn"
START_TIME="2021-01-06 17:00:00 000:000:000"
END_TIME="2021-01-06 21:00:00 000:000:000"
INTERVAL_VALUE=3

curl -k -G $URL -H $CONTENT_HEADER -H $API_HEADER --data-urlencode "tag_name=$TAG_NAME" --data-urlencode "calc_mode=$CALC_MODE" --data-urlencode "start_time=$START_TIME" --data-urlencode "end_time=$END_TIME" --data-urlencode "date_format=$DATE_FORMAT" --data-urlencode "interval_value=$INTERVAL_VALUE"

# Return Format
# {"data":{"calc_mode":"MAX","columns":[{"name":"TIME","type":5,"length":4096},{"name":"VALUE","type":20,"length":17}],"samples":[{"tag_name":"sensor2","data":[{"TIME":"2021-01-06 17:00:00 000:000:000","VALUE":2},{"TIME":"2021-01-06 17:00:03 000:000:000","VALUE":2},{"TIME":"2021-01-06 18:00:00 000:000:000","VALUE":2.5},{"TIME":"2021-01-06 20:00:03 000:000:000","VALUE":2.5},{"TIME":"2021-01-06 20:00:06 000:000:000","VALUE":2}]},{"tag_name":"sensor1","data":[{"TIME":"2021-01-06 17:00:00 000:000:000","VALUE":2},{"TIME":"2021-01-06 18:00:00 000:000:000","VALUE":2.5},{"TIME":"2021-01-06 20:00:03 000:000:000","VALUE":2.5},{"TIME":"2021-01-06 20:00:06 000:000:000","VALUE":2}]}]},"status":"success"}

# ------------------------------------------------------------------------------------------------- #

# CASE - Calculated DATA GET with date format YYYY-MM-DD HH24:MI:SS mmm:uuu:nnn with calc_mode=min and interval_type=m and interval_value=90
TAG_NAME=sensor1,sensor2
CALC_MODE=cnt
DATE_FORMAT="YYYY-MM-DD HH24:MI:SS mmm:uuu:nnn"
START_TIME="2021-01-06 17:00:00 000:000:000"
END_TIME="2021-01-06 21:00:00 000:000:000"
INTERVAL_TYPE=m
INTERVAL_VALUE=90

curl -k -G $URL -H $CONTENT_HEADER -H $API_HEADER --data-urlencode "tag_name=$TAG_NAME" --data-urlencode "calc_mode=$CALC_MODE" --data-urlencode "start_time=$START_TIME" --data-urlencode "end_time=$END_TIME" --data-urlencode "date_format=$DATE_FORMAT" --data-urlencode "interval_value=$INTERVAL_VALUE" --data-urlencode "interval_type=$INTERVAL_TYPE"

# Return Format
# {"data":{"calc_mode":"COUNT","columns":[{"name":"TIME","type":5,"length":4096},{"name":"VALUE","type":12,"length":20}],"samples":[{"tag_name":"sensor2","data":[{"TIME":"2021-01-06 16:30:00 000:000:000","VALUE":1},{"TIME":"2021-01-06 18:00:00 000:000:000","VALUE":1},{"TIME":"2021-01-06 19:30:00 000:000:000","VALUE":1}]},{"tag_name":"sensor1","data":[{"TIME":"2021-01-06 16:30:00 000:000:000","VALUE":1},{"TIME":"2021-01-06 18:00:00 000:000:000","VALUE":1},{"TIME":"2021-01-06 19:30:00 000:000:000","VALUE":1}]}]},"status":"success"}

# ------------------------------------------------------------------------------------------------- #
Expand
titlejavascript

github

Code Block
// Example For Select Calculated Data for tag API by using request in node js
// written by yeony kim
// sensor1, sensor2 is applied in lake

process.env.NODE_TLS_REJECT_UNAUTHORIZED ="0";

const express = require('express');
const app = express();
const API_KEY ="YOUR_API_TOKEN";
const LAKE_ID ="YOUR_LAKE_ID"
const URL ="https://" + LAKE_ID +".machlake.com/lakes/values/calculated";

// CASE - Calculated DATA GET with date format YYYY-MM-DD HH24:MI:SS mmm:uuu:nnn with calc_mode=min

app.get(
    '/select_calculated_date_with_nano_time_date_string', function(req, res) {
        var request = require('request');

        const QueryParams = new URLSearchParams()
        
        QueryParams.set('tag_name', 'sensor1,sensor2')
        QueryParams.set('calc_mode', 'min')
        QueryParams.set('date_format', 'YYYY-MM-DD HH24:MI:SS mmm:uuu:nnn')
        QueryParams.set('start_time', '2021-01-06 17:00:00 000:000:000')
        QueryParams.set('end_time', '2021-01-06 21:00:00 000:000:000')

        var option = {
            url: URL + "?" + QueryParams.toString(),
            headers: {
                'Content-Type': 'application/json',
                'x-api-key': API_KEY
            },
        };
        request.get( option, function(error, response, body) {
            if (!error) {
                res.writeHead(200);
                res.end(body);
                console.log(body) // {"data":{"calc_mode":"MIN","columns":[{"name":"TIME","type":5,"length":4096},{"name":"VALUE","type":20,"length":17}],"samples":[{"tag_name":"sensor1","data":[{"TIME":"2021-01-06 17:00:00 000:000:000","VALUE":1},{"TIME":"2021-01-06 18:00:00 000:000:000","VALUE":2},{"TIME":"2021-01-06 20:00:04 000:000:000","VALUE":2},{"TIME":"2021-01-06 20:00:05 000:000:000","VALUE":2.5},{"TIME":"2021-01-06 20:00:06 000:000:000","VALUE":2}]},{"tag_name":"sensor2","data":[{"TIME":"2021-01-06 17:00:00 000:000:000","VALUE":1},{"TIME":"2021-01-06 17:00:01 000:000:000","VALUE":1.5},{"TIME":"2021-01-06 17:00:02 000:000:000","VALUE":2},{"TIME":"2021-01-06 17:00:03 000:000:000","VALUE":1},{"TIME":"2021-01-06 17:00:04 000:000:000","VALUE":1.5},{"TIME":"2021-01-06 17:00:05 000:000:000","VALUE":2},{"TIME":"2021-01-06 18:00:00 000:000:000","VALUE":2},{"TIME":"2021-01-06 20:00:04 000:000:000","VALUE":2},{"TIME":"2021-01-06 20:00:05 000:000:000","VALUE":2.5},{"TIME":"2021-01-06 20:00:06 000:000:000","VALUE":2}]}]},"status":"success"}
            } else {
                console.log(error)
            }
        })
    }
)

// CASE - Calculated DATA GET with date format YYYY-MM-DD HH24:MI:SS mmm:uuu:nnn with calc_mode=max and interval_value=3

app.get(
    '/select_calculated_date_with_nano_time_date_string_with_max_option', function(req, res) {
        var request = require('request');

        const QueryParams = new URLSearchParams()
        
        QueryParams.set('tag_name', 'sensor1,sensor2')
        QueryParams.set('calc_mode', 'max')
        QueryParams.set('date_format', 'YYYY-MM-DD HH24:MI:SS mmm:uuu:nnn')
        QueryParams.set('start_time', '2021-01-06 17:00:00 000:000:000')
        QueryParams.set('end_time', '2021-01-06 21:00:00 000:000:000')
        QueryParams.set('interval_value', 3)

        var option = {
            url: URL + "?" + QueryParams.toString(),
            headers: {
                'Content-Type': 'application/json',
                'x-api-key': API_KEY
            },
        };
        request.get( option, function(error, response, body) {
            if (!error) {
                res.writeHead(200);
                res.end(body);
                console.log(body) // {"data":{"calc_mode":"MAX","columns":[{"name":"TIME","type":5,"length":4096},{"name":"VALUE","type":20,"length":17}],"samples":[{"tag_name":"sensor2","data":[{"TIME":"2021-01-06 17:00:00 000:000:000","VALUE":2},{"TIME":"2021-01-06 17:00:03 000:000:000","VALUE":2},{"TIME":"2021-01-06 18:00:00 000:000:000","VALUE":2.5},{"TIME":"2021-01-06 20:00:03 000:000:000","VALUE":2.5},{"TIME":"2021-01-06 20:00:06 000:000:000","VALUE":2}]},{"tag_name":"sensor1","data":[{"TIME":"2021-01-06 17:00:00 000:000:000","VALUE":2},{"TIME":"2021-01-06 18:00:00 000:000:000","VALUE":2.5},{"TIME":"2021-01-06 20:00:03 000:000:000","VALUE":2.5},{"TIME":"2021-01-06 20:00:06 000:000:000","VALUE":2}]}]},"status":"success"}
            } else {
                console.log(error)
            }
        })
    }
)

// CASE - Calculated DATA GET with date format YYYY-MM-DD HH24:MI:SS mmm:uuu:nnn with calc_mode=min and interval_type=m and interval_value=90

app.get(
    '/select_calculated_date_with_nano_time_date_string_with_max_interval_option', function(req, res) {
        var request = require('request');

        const QueryParams = new URLSearchParams()
        
        QueryParams.set('tag_name', 'sensor1,sensor2')
        QueryParams.set('calc_mode', 'max')
        QueryParams.set('date_format', 'YYYY-MM-DD HH24:MI:SS mmm:uuu:nnn')
        QueryParams.set('start_time', '2021-01-06 17:00:00 000:000:000')
        QueryParams.set('end_time', '2021-01-06 21:00:00 000:000:000')
        QueryParams.set('interval_type', 'm')
        QueryParams.set('interval_value', 90)

        var option = {
            url: URL + "?" + QueryParams.toString(),
            headers: {
                'Content-Type': 'application/json',
                'x-api-key': API_KEY
            },
        };
        request.get( option, function(error, response, body) {
            if (!error) {
                res.writeHead(200);
                res.end(body);
                console.log(body) // {"data":{"calc_mode":"MAX","columns":[{"name":"TIME","type":5,"length":4096},{"name":"VALUE","type":20,"length":17}],"samples":[{"tag_name":"sensor2","data":[{"TIME":"2021-01-06 16:30:00 000:000:000","VALUE":2},{"TIME":"2021-01-06 18:00:00 000:000:000","VALUE":2.5},{"TIME":"2021-01-06 19:30:00 000:000:000","VALUE":2.5}]},{"tag_name":"sensor1","data":[{"TIME":"2021-01-06 16:30:00 000:000:000","VALUE":2},{"TIME":"2021-01-06 18:00:00 000:000:000","VALUE":2.5},{"TIME":"2021-01-06 19:30:00 000:000:000","VALUE":2.5}]}]},"status":"success"}
            } else {
                console.log(error)
            }
        })
    }
)

app.listen(8888, function() {
    console.log('http://127.0.0.1:8888/select_current_date_with_nano_time_date_string is result for select calculated data with nano date time string with calc_mode=min')
    console.log('http://127.0.0.1:8888/select_calculated_date_with_nano_time_date_string_with_max_option is result for select calculated data with nano date time string with calc_mode=max and interval_value=3')
    console.log('http://127.0.0.1:8888/select_calculated_date_with_nano_time_date_string_with_max_interval_option is result for select calculated data with nano date time string with calc_mode=max and interval_type=m interval_value=90')
})

...

titlepython

github

...