跳轉到

API 接口

注意事項

下述的所有API皆不包含在ArctosLinks SDK內,請開發者自行實作。

ArctosLinks需要通過一組通行令牌來完成啟動,以下提供一套獲取通行令牌的API。

Base URL

https://api-healthplus-sit.arctos.tw

獲得認證碼

端點:/api/auth/code

方法:POST

注意事項

認證碼有效期限為十分鐘。

描述:選定使用身份後,申請一組認證碼。

HTTP頭欄位

Http Header Contents
Content-Type application/json
arc-license-key your_license_key

請求參數

參數名稱 類型 必填 描述
user_id String Y 一組能夠代表使用者的唯一識別字串
name String Y 使用者名稱
role String Y 申請到的憑證對應之使用身份,可用SWITCHCLIENT

回應參數

參數名稱 類型 描述
status Int 一組能夠代表使用者的唯一識別字串
message String 錯誤描述,若成功則為空字串
info Object 夾帶認證碼資訊的物件
code String 認證碼

請求範例

POST /api/auth/code HTTP/1.1
Host: api-healthplus-sit.arctos.tw
Content-Type: application/json
arc-license-key: {your_license_key}

{
  "user_id": "unique_id",
  "name": "SWITCH_User_007",
  "role": "SWITCH"
}
{
    "status": 1,
    "message": "",
    "info": {
        "code":"XXXXXXXXXXXXXXXXXXXX"
    }
}

Http狀態碼

狀態碼 狀態 描述
200 0 Unauthorized Access
1 Success
403 Access to the requested resource is not allowed
404 UnResource Not Found

獲取通行令牌

端點:/api/auth/login

方法:POST

描述:使用取得的認證碼,換發SDK通行令牌。

HTTP頭欄位

Http Header Contents
Content-Type application/json

請求參數

參數名稱 類型 必填 描述
grant_type String Y 指定授權類型,固定帶authorization_code
client_id String Y 依據選擇的身份填入對應的值。若是SWITCH則為arctos-switch;若是CLIENT則填入arctos-client
code String Y 申請到的認證碼
redirect_uri String N 將返回的頁面,可為null。

回應參數

參數名稱 類型 描述
status Int 一組能夠代表使用者的唯一識別字串
message String 錯誤描述,若成功則為空字串
info Object 夾帶通行令牌與使用者識別碼資訊的物件
user_id Int 使用者識別碼
access_token String 通行令牌

請求範例

POST /api/auth/code HTTP/1.1
Host: api-healthplus-sit.arctos.tw
Content-Type: application/json

{
    "grant_type":"authorization_code",
    "client_id":"arctos-switch",
    "code":"XXXXXXXXXXX",
    "redirect_uri":"https://XXXXX.XXX.XXX"
}
{
    "status": 1,
    "message": "",
    "info": {
        "user_id": 1010000010,
        "access_token": "eyJ0eXAiOiJKV1QiLCXXXXXXXXX"
        }
}

Http狀態碼

狀態碼 狀態 描述
200 0 Unauthorized Access
1 Success
403 Access to the requested resource is not allowed
404 UnResource Not Found