...
Paste code macro |
---|
language | http |
---|
theme | Sunburst |
---|
|
DELETE
https://${CloudVendor}.${CountryCode}.machlake.com/v1/lakes/${lake_id}/tags
Content-Type: application/json; charset=utf8
x-api-key: {API Key}
{
"name" : "{name_of_tag}"
} |
Parameters
...
Parameters
Optional | Type | Description | Example |
---|
name | String | tag name | &name=tag1 |
Request Example
Paste code macro |
---|
language | http |
---|
theme | Sunburst |
---|
|
DELETE
https://aws1.us.machlake.com/v1/lakes/xbacd1234/tags?name=newtag02
Content-Type: application/json; charset=utf8
x-api-key: {API Key}
{
"name" : "newtag02"
} |
...
Response Example
Paste code macro |
---|
language | json |
---|
theme | Sunburst |
---|
|
Status 200
{
"statussuccess": "success"true,
"datareason": {}"delete tag meta success"
} |
Sample Code
In this sample, tag contains sensor1, sensor2, so if that not contains then result should be different
Expand |
---|
|
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
KEY
set LAKE_ID=YOUR_LAKE_ID
set CONTENTCLOUD_HEADER="ContentVENDOR=YOUR_CLOUD_VENDOR
set CLOUD_REGION=YOUR_CLOUD_REGION
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%%CLOUD_VENDOR%.%CLOUD_REGION%.machlake.com/v1/lakes/%LAKE_ID%/tags"
:: ------------------------------------------------------------------------------------------------- ::
:: CASE - delete errortag
when no exist tag name
set TAG_NAME=sensor
TAG_NAME=sensor1
curl -k -X DELETE %URL% -H %CONTENT_HEADER% -H %API_HEADER% \
-d "{\"name\": \" --data-urlencode "name=%TAG_NAME%\"}"
:: Return Format
/:: Example{
for:: tag name does not exist in lake
"success":true,
:: {"message "reason":"nodelete tag suchmeta namesuccess"
: sensor","status":"error": }
:: ------------------------------------------------------------------------------------------------- ::#
:: CASE - delete error when no exist tag name
set
TAG_NAME=sensor1wrong_name
curl -k -X DELETE %URL% -H %CONTENT_HEADER% -H %API_HEADER% \
--data-durlencode "{\"name\": \"%TAG=%TAG_NAME%\"}"
:: Return Format
/:: Examplestatus forcode:400 deleteBad tagRequest
:: {"data
:: "success":{},"statusfalse,
:: "reason":"success"}
no such name:wrong_name"
:: ------------------------}
|
|
Expand |
---|
|
github Code Block |
---|
| # 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
CONTENT_HEADER=Content-Type:application/json
API_HEADER=x-api-key:$API_KEY
URL=https://${CLOUD_VENDOR}.${CLOUD_REGION}.machlake.com/v1/lakes/${LAKE_ID}/tags
# -------------------------------------------------------------------------- ::
::----------------------- #
# CASE - delete tag
set TAG_NAME=sensor2sensor1
curl -k -X DELETE %URL%$URL -H %CONTENT$CONTENT_HEADER%HEADER -H %API_HEADER% -d "{\"name\": \"%TAG_NAME%\"}"
::$API_HEADER \
--data-urlencode "name=$TAG_NAME"
# Return Format
# /{
Example# for delete tag :: {"datasuccess":{},"statustrue,
# "reason":"delete tag meta success"}
|
|
Expand |
---|
|
github Code Block |
---|
# Text}
Encoding
to UTF-8 in CMD
# Example For Delete Tag API by using curl in ubuntu
# written by yeony kim
# sensor1, sensor2 is applied in lake
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/tags
# # ------------------------------------------------------------------------------------------------------------------------------------- #
# CASE - delete error when no exist #
# CASE - delete error when no exist tag name
TAG_NAME=sensorwrong_name
curl -k -X DELETE $URL -H $CONTENT_HEADER -H $API_HEADER \
--data-durlencode "{\"name\": \"name=$TAG_NAME\"}"
# Return Format
# /status Examplecode:400 forBad tagRequest
name# does{
not# exist in lake # {"messagesuccess":"no such name : sensor","statusfalse,
# "reason":"error"}no
# ------------------------------------------------------------------------------------------------- #
# 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"}
#such name:wrong_name"
# }
|
|
Expand |
---|
|
github Code Block |
---|
| // 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 URL = `https://${CLOUD_VENDOR}.${CLOUD_REGION}.machlake.com/v1/lakes/${LAKE_ID}/tags`;
var request = require('request');
/* ------------------------------------------------------------------------------------------------- #*/
#// CASE - delete tag
TAG_NAME=sensor2request.delete({
curl -k -X DELETE $URL -H $CONTENT_HEADER -H $API_HEADER -d "{\"name\": \"$TAG_NAME\"}"
# Return Format / Example for delete tag
# {"data":{},"status":"success"} |
|
Expand |
---|
|
github Code Block |
---|
| // 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 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/tags";
// CASE - delete error when no exist tag name
app.get(
'/delete_tag_name_sensor', function(req, res) {
const Data = {
url: URL,
headers: {
"Content-Type": "application/json",
"x-api-key": API_KEY
},
qs: {
name: "sensor1"
}},
function(error, response, body) {
console.log(body);
// Return Format
// {
// "success":true,
// "reason":"delete tag meta success"
// }
name: 'sensor', })
}
var request = require('request');
var option = {
url: URL,
headers: /* ------------------------------------------------------------------------------------------------- */
// CASE - delete error when no exist tag name
request.delete({
url: URL,
headers: {
'"Content-Type'": '"application/json'",
'"x-api-key'": API_KEY
},
qs: {
}, name: "sensor1"
body: JSON.stringify(Data)}},
function(error, response, body) {
}; request.delete( option, function(error, response, body) {console.log(body);
// Return Format
if (!error) { // status code:400 Bad Request
res.writeHead(200);
// {
// "success":false,
res.end(body); // console.log(body) // {"datareason":{},"status":"success"} or {"message":"no such name : sensor1","status":"error"}:wrong_name"
// }
else { })
|
|
Expand |
---|
|
github Code Block |
---|
| """
Example For Delete Tag API by using requests in python
written console.log(error)
}
})
}
)
// CASE - delete tag
app.get(
'/delete_tag_name_sensor1', function(req, res)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/v1/lakes/{LAKE_ID}/tags"
headers = {
"Content-Type": "application/json",
const Data = {
name: 'sensor1',
"x-api-key": API_KEY
}
var request = require('request');
var option = {
url: URL,
headers: {
'Content-Type': 'application/json',
'x-api-key': API_KEY
},
body: JSON.stringify(Data)
};
request.delete( option, function(error, response, body) {
if (!error) {
res.writeHead(200);
res.end(body);
console.log(body) // {"data":{},"status":"success"} or {"message":"no such name : sensor1","status":"error"}
} else {
console.log(error)
}
})
}
)
// CASE - delete tag
app.get(
'/delete_tag_name_sensor2', function(req, res) {
const Data = {
name: 'sensor2',
}
var request = require('request');
var option = {
url: URL,
headers: {
'Content-Type': 'application/json',
'x-api-key': API_KEY
},
body: JSON.stringify(Data)
};
request.delete( option, function(error, response, body) {
if (!error) {
res.writeHead(200);
res.end(body);
console.log(body) // {"data":{},"status":"success"} or {"message":"no such name : sensor1","status":"error"}
} else {
console.log(error)
}
})
}
)
app.listen(8888, function() {
console.log('http://127.0.0.1:8888/delete_tag_name_sensor is result for delete sensor tag (error)')
console.log('http://127.0.0.1:8888/delete_tag_name_sensor1 is result for delete sensor1 tag')
console.log('http://127.0.0.1:8888/delete_tag_name_sensor1 is result for delete sensor2 tag')
}) |
|
Expand |
---|
|
github Code Block |
---|
"""
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"
URL = f"https://{LAKE_ID}.machlake.com/lakes/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# ------------------------------------------------------------------------------------------------- #
# CASE - delete tag
params = {
"name": "sensor",
}
response = requests.delete(URL, headers=headers, params=params, verify=False)
print(response.content.decode("utf-8"))
# Return Format
# {
# "success":true,
# "reason":"delete tag meta success"
# }
# ------------------------------------------------------------------------------------------------- #
# CASE - delete error when no exist tag name
params = {
'"name'": 'sensor2'"wrong_name",
}
response = requests.delete(URL, headers=headers, jsonparams=params, verify=False)
print(response.content.decode('"utf-8'"))
# Return Format
# status code:400 Bad Request
# {"data
# "success":{},"statusfalse,
# "reason":"success"}no such name:wrong_name"
# }
|
|