Versions Compared

Key

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

...

Code Block
Status 200

{
    "status": "success",
    "data": {}
}

Sample Code

In this sample, tag contains sensor1, sensor2, so if that not contains then result should be different이 예제에서, sensor1, sensor2의 tag가 사전에 생성되어 있는 것을 가정한다. 해당 tag가 없으면 오류로 처리된다.

Expand
titlewindow(batch)

github

Code Block
chcp 65001 
:: Text Encoding to UTF-8 in CMD
:: Example For Delete Tag API by using curl in window script
:: written by yeony kim
:: sensor1, sensor2 is applied in lake

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/tags

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

:: CASE - delete error when no exist tag name

set TAG_NAME=sensor

curl -k -X DELETE %URL% -H %CONTENT_HEADER% -H %API_HEADER% -d "{\"name\": \"%TAG_NAME%\"}"

:: Return Format / Example for tag name does not exist in lake
:: {"message":"no such name : sensor","status":"error"}

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

:: CASE - delete tag

set TAG_NAME=sensor1

curl -k -X DELETE %URL% -H %CONTENT_HEADER% -H %API_HEADER% -d "{\"name\": \"%TAG_NAME%\"}"

:: Return Format / Example for delete tag
:: {"data":{},"status":"success"}

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

:: CASE - delete tag

set TAG_NAME=sensor2

curl -k -X DELETE %URL% -H %CONTENT_HEADER% -H %API_HEADER% -d "{\"name\": \"%TAG_NAME%\"}"

:: Return Format / Example for delete tag
:: {"data":{},"status":"success"}

...