Versions Compared

Key

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

...

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_TOKENKEY

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

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

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

:: CASE - GET LAKE List

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

:: Return Format
:: {"data":{"lake":[{
::     "success" : true,
::     "reason"  : "get list success",
::     "data": [
::         {
::             "lake_id" : "YOUR_LAKE_ID",{lake_id}",
::             "lake_info" : {
::                 "lake_name"    : "sample_lake",
::                 "lake_plan"    : "basic",
::                 "region"       :"ap-northeast-2","timezone": "aws1.kor",
::                 "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

API_KEY=$YOUR_API_KEY

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

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

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

# CASE - GET LAKE List

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

# Return Format
# {
#     "success" : true,
#     "reason"  : "get list success",
#     "data": [
#         {
#             "lake_id" : "{lake_id}",
#             "lake_info" : {
#                 "lake_name"    : "sample_lake",
#                 "lake_plan"    : "basic",
#                 "region"       : "aws1.kor",
#                 "timezone"     : "Asia/Seoul"
#             }
#         },
#         ......
#     ]
# }

...