/
Standard Insert
Standard Insert
[ 1 HTTP Request ] [ 1.1 Parameters ] [ 2 Request Example ] [ 3 Response Example ] [ 4 Sample Code ]
Json 포멧으로 tag name, 시간, 다른 칼럼값들을 지정하여 입력하는 표준 입력 방법이다. 이 API는 모든 센서 데이터에 대해서 JSON포멧으로 칼럼 명을 지정해 주어야 하기 때문에 데이터 용량이 커져서 비용과 성능이 감소하는 문제가 있지만 입력하는 tag의 수가 적은 경우 간편하게 사용할 수 있다.
HTTP Request
POST https://${CloudVendor}.${CountryCode}.machlake.com/lakes/${lake_id}/values/standard
Content-Type: application/json; charset=utf8
x-api-key: {API Key}
{
"tag_name" : "{name_of_tag}",
"date_format" : "{date_format}",
"values" : [["{time1}", {value1}], ["{time2}", {value2}], ... ]
}
Parameters
no parameters
Request Example
POST https://aws1.us.machlake.com/lakes/xbacd1234/values/standard
Content-Type: application/json; charset=utf8
x-api-key: {API Key}
{
"tag_name" : "tag_01",
"date_format" : "YYYY-MM-DD HH24:MI:SS",
"values" : [
["2021-07-06 12:12:22", 1234.0],
["2021-07-06 12:12:23", 2345.0],
["2021-07-06 12:12:24", 2346.0]
]
}
Response Example
Status 200
{
"status": "success",
"data": {
"fail": 0,
"success": 3
}
}
Sample Code
이 샘플코드는 lake 생성시에 value_schema를 [time:datetime, value: double]로 지정한것으로 가정하였다. 만약 value_schema를 이와 다른 형태로 지정하였다면 다른 형태의 입력값을 이용해야 한다. 또한, 스키마에서 설정한 순서대로 데이터를 입력하여야 한다.