Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 3 Next »

지정한 tag정보와 등록된 모든 데이터를 삭제한다. Tag_name 매개변수는 반드시 지정해야 한다.

HTTP Request

DELETE https://${CloudVendor}.${CountryCode}.machlake.com/lakes/${lake_id}/tags
Content-Type: application/json; charset=utf8
x-api-key: {API Key}
 
{
    "name"   : "{name_of_tag}"
}

Parameters

no parameters

Request Example

DELETE https://aws1.us.machlake.com/lakes/xbacd1234/tags
Content-Type: application/json; charset=utf8
x-api-key: {API Key}
 
{
    "name"   : "newtag02"
}

Response Example

Status 200

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

Sample Code

In this sample, tag contains sensor1, sensor2, so if that not contains then result should be different

 window(batch)

github

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"}

 linux(shell)

github

# Text Encoding to UTF-8 in CMD
# Example For Delete 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 - delete error when no exist tag name

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

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

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"}
Footer
© 2022 GitHub, Inc.
Footer navigation
Terms
Privacy
Sec
 javascript

github

// Example For Delete Tag API by using request in nodejs
// written by yeony kim
// sensor1, sensor2 is applied in lake

// process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";

const API_KEY = "YOUR_API_TOKEN";
const LAKE_ID = "YOUR_LAKE_ID";
const CLOUD_VENDOR="CLOUD_VENDOR";
const CLOUD_REGION="CLOUD_REGION";
const TAG_NAME = "YOUR_TAG";
const URL = `https://${CLOUD_VENDOR}.${CLOUD_REGION}.machlake.com/lakes/${LAKE_ID}/tags`;

var request = require('request');

// CASE - delete tag
var Data = Data = {
    name: TAG_NAME,
}
request.delete({
    url: URL, 
    headers: {
        'Content-Type': 'application/json',
        'x-api-key': API_KEY
    },
    body: JSON.stringify(Data)
    }, 
    function(error, response, body) {
        // {"data":{},"status":"success"}
        console.log(body)
    })


// CASE - delete error when no exist tag name
var Data = Data = {
    name: 'wrong_name',
}
request.delete({
    url: URL, 
    headers: {
        'Content-Type': 'application/json',
        'x-api-key': API_KEY
    },
    body: JSON.stringify(Data)
    }, 
    function(error, response, body) {
        // {"message":"no such name : wrong_name","status":"error"}
        console.log(body)
    })
 python

github

"""
Example For Delete Tag API by using requests in python
written by yeony kim
sensor1, sensor2 is applied in lake
"""

import requests

API_KEY = "YOUR_API_TOKEN"
LAKE_ID = "YOUR_LAKE_ID"
CLOUD_VENDOR="CLOUD_VENDOR"
CLOUD_REGION="CLOUD_REGION"

URL = f"https://{CLOUD_VENDOR}.{CLOUD_REGION}.machlake.com/lakes/{LAKE_ID}/tags"

headers = {
    'Content-Type': 'application/json',
    'x-api-key': API_KEY
}

# CASE - delete error when no exist tag name

params = {
    'name': 'sensor',
}

response = requests.delete(URL, headers=headers,  json=params, verify=False)
print(response.content.decode('utf-8'))  # {"message":"no such name : sensor","status":"error"}

# CASE - delete tag

params = {
    'name': 'sensor1',
}

response = requests.delete(URL, headers=headers,  json=params, verify=False)
print(response.content.decode('utf-8'))  # {"data":{},"status":"success"}

# CASE - delete tag

params = {
    'name': 'sensor2',
}

response = requests.delete(URL, headers=headers,  json=params, verify=False)
print(response.content.decode('utf-8'))  # {"data":{},"status":"success"}
  • No labels