Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: v. 4에서 되돌림

...

Info

이 API는 접속한 사용자가 생성한 데이터 레이크의 목록을 반환한다. 각 Lake의 자세한 정보는 반환되지 않으므로, Lake의 자세한 정보를 원한다면 View Lake API를 이용해야 한다.

HTTP Request

Code Block
GET https://${CloudVendor}.${CountryCode}.machlake.com/lakes

Parameters

no parameters

Request Example

Code Block
GET https://aws1.us.machlake.com/lakes/
Content-Type: application/json; charset=utf8
x-api-key: {API Key}

Response Example

Code Block
Status 200

{
    "lake": [
        {
            "lake_id": "lake01",
            "lake_info": {
                "lake_name": "My Lake1",
                "lake_plan": "basic",
                "region"   : "us-west-1",
                "timezone" : "America/Los_Angeles"
            }
        },
        {
            "lake_id": "lake02",
            "lake_info": {
                "lake_name": "My Lake2",
                "lake_plan": "enterprise",
                "region"   : "ap-northeast-2",
                "timezone" : "Asia/Seoul"
            }
        }
    ]
}

Sample Code

Expand
titlewindow(batch)

github

Code Block
chcp 65001 
:: Text Encoding to UTF-8 in CMD
:: Example For Get Lake List API by using curl in window script
:: written by yeony kim

set API_KEY=YOUR_API_TOKEN

set CONTENT_HEADER="Content-Type: application/json"
set API_HEADER="x-api-key: %API_KEY%"

set URL=https://api.machlake.com/lakes

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

:: CASE - GET LAKE List

curl -k -X GET %URL% -H %CONTENT_HEADER% -H %API_HEADER%

:: Return Format
:: {"data":{"lake":[{"lake_id":"YOUR_LAKE_ID","lake_info":{"lake_name":"sample_lake","lake_plan":"basic","region":"ap-northeast-2","timezone":"Asia/Seoul"}}],"mount":[],"share":[]},"status":"success"}
Expand
titlelinux(shell)

github

Code Block
# Text Encoding to UTF-8 in CMD
# Example For Get Lake List API by using curl in shell script
# written by yeony kim

API_KEY=YOUR_API_TOKEN

CONTENT_HEADER="Content-Type:application/json"
API_HEADER="x-api-key:$API_KEY"

URL=https://api.machlake.com/lakes

# ------------------------------------------------------------------------------------------------- #

# CASE - GET LAKE List

curl -k -X GET $URL -H $CONTENT_HEADER -H $API_HEADER

# Return Format
# {"data":{"lake":[{"lake_id":"YOUR_LAKE_ID","lake_info":{"lake_name":"sample_lake","lake_plan":"basic","region":"ap-northeast-2","timezone":"Asia/Seoul"}}],"mount":[],"share":[]},"status":"success"}
Expand
titlejavascript

github

Code Block
// Example For Get Lake List API by using request in nodejs
// written by yeony kim

process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";

const express = require('express');
const app = express();
const API_KEY = "YOUR_API_TOKEN";
const URL = "https://api.machlake.com/lakes"

// CASE - GET LAKE List

app.get(
    '/get_lake_list', function(req, res) {
        var request = require('request');
        var option = {
            url: URL,
            headers: {
                'Content-Type': 'application/json',
                'x-api-key': API_KEY
            },
        };
        request.get( option, function(error, response, body) {
            if (!error) {
                res.writeHead(200);
                res.end(body);
                console.log(body) // {"data":{"lake":[{"lake_id":"YOUR_LAKE_ID","lake_info":{"lake_name":"sample_lake","lake_plan":"basic","region":"ap-northeast-2","timezone":"Asia/Seoul"}}],"mount":[],"share":[]},"status":"success"}
            } else {
                console.log(error)
            }
        })
    }
)

app.listen(8888, function() {
    console.log('http://127.0.0.1:8888/get_lake_list is result for get LAKE list')
})
Expand
titlepython

github

Code Block
"""
Example For Get Lake List API by using request in python
written by yeony kim
"""

import requests

API_KEY = "YOUR_API_TOKEN"
URL = f"https://api.machlake.com/lakes"

# CASE - GET LAKE List

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

response = requests.get(URL, headers=headers, verify=False)
print(response.content.decode('utf-8'))  # {"data":{"lake":[{"lake_id":"YOUR_LAKE_ID","lake_info":{"lake_name":"sample_lake","lake_plan":"basic","region":"ap-northeast-2","timezone":"Asia/Seoul"}}],"mount":[],"share":[]},"status":"success"}