...
이 예제는 sensor1, sensor2의 이름을 갖는 tag를 생성한다. Tag_schema 메타정보는 name column만을 갖는 상황이므로 json데이터는 name_variable의 배열로 구성되었다. Tag_schema가 다른 경우 추가 필드값이 필요할 수 있다.expand
Expand | |||||
---|---|---|---|---|---|
| |||||
|
...
title | python |
---|
...
language | py |
---|
...
Type |
---|
...
title | Linux(Shell) |
---|
...
Code Block | ||
---|---|---|
| ||
# Text Encoding to UTF-8 in CMD
# Example For Create Tag API by using curl in ubuntu
LAKE_ID=$YOUR_LAKE_ID
API_KEY=$YOUR_API_KEY
CLOUD_VENDOR=$YOUR_CLOUD_VENDOR
CLOUD_REGION=$YOUR_CLOUD_REGION
TAG_NAME=$YOUR_TAG_NAME
CONTENT_HEADER=Content-Type:application/json
API_HEADER=x-api-key:$API_KEY
URL=https://${CLOUD_VENDOR}.${CLOUD_REGION}.machlake.com/lakes/${LAKE_ID}/tags
# ------------------------------------------------------------------------------------------------- #
# CASE - create TAG
curl -k -X POST $URL -H $CONTENT_HEADER -H $API_HEADER --data "{\"tag\": [[\"sensor1\"], [\"sensor2\"]]}"
# Return Format
# {"data":{"success_count":2,"tag":[{"name":"sensor1"},{"name":"sensor2"}]},"status":"success"}
# ------------------------------------------------------------------------------------------------- #
# CASE - tag duplicate error
curl -k -X POST $URL -H $CONTENT_HEADER -H $API_HEADER --data "{\"tag\": [[\"sensor1\"], [\"sensor2\"]]}"
# Return Format / Example For Exist same tag name in lake
# {"message":"Metadata key (sensor2) of TAGDATA table is already inserted.","status":"error"}
# ------------------------------------------------------------------------------------------------- #
|