Versions Compared

Key

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

...

Optional

Type

Description

Example

name

string

name prefix of tag검색할 tag name 문자열 해당 문자열을 포함하는 tag 정보를 반환한다.

&name=new

limit

intcount of display

한꺼번에 표시할 갯수

0 = no limit.

(It depends on the limit limitation of lake tierLake 생성시 설정에 따라 0일 경우에도 제한이 발생할 수 있다.)

&limit=100

offset

intcount of skip

여러 페이지로 표시하기 위해 건너뛰어야 할 데이터의 수

&offset=50

Request Example

...

Code Block
languagejson
Status 200
 
{
    "status": "success",
    "data": {
        "tag": [
            {"name": "newtag01"},
            {"name": "newtag02"}
        ]
    }
}

Sample Code

in sample code, select tag meta information that defined in create lake api이 예제 코드에서는, Create lake api에서 지정한 메타 정보를 검색한다.

Expand
titlewindow(batch)

github

Code Block
chcp 65001 
:: Text Encoding to UTF-8 in CMD
:: Example For Get Tag List 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 - Select Tag

set TAG_NAME=sensor
set QUERY_LIMIT=
set QUERY_OFFSET=


curl -k -G %URL% -H %CONTENT_HEADER% -H %API_HEADER% --data-urlencode "name=%TAG_NAME%" --data-urlencode "limit=%QUERY_LIMIT%" --data-urlencode "offset=%QUERY_OFFSET%"

:: Return Format / Example For 
:: {"data":{"tag":[{"name":"sensor1"},{"name":"sensor2"}]},"status":"success"}

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

:: CASE - Select Tag with SQL Limit

set QUERY_LIMIT=1
set QUERY_OFFSET=

curl -k -G %URL% -H %CONTENT_HEADER% -H %API_HEADER% --data-urlencode "name=%TAG_NAME%" --data-urlencode "limit=%QUERY_LIMIT%" --data-urlencode "offset=%QUERY_OFFSET%"

:: Return Format
:: {"data":{"tag":[{"name":"sensor1"}]},"status":"success"}

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

:: CASE - Select Tag with SQL Limit and SQL Offset

set QUERY_LIMIT=1
set QUERY_OFFSET=1

curl -k -G %URL% -H %CONTENT_HEADER% -H %API_HEADER% --data-urlencode "name=%TAG_NAME%" --data-urlencode "limit=%QUERY_LIMIT%" --data-urlencode "offset=%QUERY_OFFSET%"

:: Return Format
:: {"data":{"tag":[{"name":"sensor2"}]},"status":"success"}

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

:: CASE - Select Tag about not exist

set TAG_NAME=OTHER_NAME
set QUERY_LIMIT=
set QUERY_OFFSET=

curl -k -G %URL% -H %CONTENT_HEADER% -H %API_HEADER% --data-urlencode "name=%TAG_NAME%" --data-urlencode "limit=%QUERY_LIMIT%" --data-urlencode "offset=%QUERY_OFFSET%"

:: Return Format
:: {"data":{"tag":[]},"status":"success"}

...