搜尋⋯
on

API 域名操作

API Token Headers

以下 API 皆需 API Token 相關 Header

  • SKC-RefreshToken
  • SKC-AccessToken

取得域名列表

GET /api/v1/user/site/{siteID}/domains

描述

根據站點 ID 取得此站點下的所有域名列表

cURL 範例

curl --request GET \
    --header "SKC-RefreshToken: {Your Refresh Token}" \
    --header "SKC-AccessToken: {Your Access Token}" \
    {CDNRay API Endpoint}/api/v1/user/site/{siteID}/domains?page=1&pageSize=10

詳細內容

  • URL Parameters:
    • page: 頁數
    • pageSize: 每頁顯示數量
  • Response
{
    "code": 101001,
    "total": 2,
    "data": [
        {
            "createdAt": "2023-08-17T15:46:36.461+08:00",
            "updatedAt": "2023-08-17T15:46:36.461+08:00",
            "id": 8,
            "name": "kk2k.com",
            "scheme": 0,
            "autoSSL": false,
            "hsts": false,
            "forceSSL": false,
            "hashType": 0,
            "failTimeOut": 0,
            "maxFails": 0,
            "portMap": false,
            "hostName": "",
            "tags": [],
            "status": 1,
            "cnameStatus": 0,
            "certificateID": 0,
            "certificateName": "",
            "certificateAutoStatus": 0,
            "certificateMemo": "",
            "upstreamURL": "1.1.1.1:80",
            "upstreamCount": 1,
            "customHeaderModuleID": 0,
            "customHeaderModuleName": "",
            "urlRedirectModuleID": 0,
            "urlRedirectModuleName": ""
        }
    ]
}

新增域名

POST /api/v1/user/site/{siteID}/domains

描述

根據站點 ID 新增數個域名

cURL 範例

curl --request POST \
    --header 'Content-Type: application/json' \
    --header "SKC-RefreshToken: {Your Refresh Token}" \
    --header "SKC-AccessToken: {Your Access Token}" \
    --data '{
        "domains": [
            {
                "name": "kkk.com",
                "scheme": 0,
                "autoSSL": false,
                "forceSSL": false,
                "portMap": false,
                "tags": [],
                "status": 1,
                "certificateID": 0,
                "customHeaderModuleID": 0,
                "upstreams": [
                    {
                        "ip": "1.1.1.1",
                        "port": 80,
                        "weight": 1
                    }
                ]
            }
        ]
    }' \
    {CDNRay API Endpoint}/api/v1/user/site/{siteID}/domains

詳細內容

  • Payload:
{
    "domains": [
        {
            "name": "kkk.com",
            "scheme": 0,
            "autoSSL": false,
            "forceSSL": false,
            "portMap": false,
            "tags": [],
            "status": 1,
            "certificateID": 0,
            "customHeaderModuleID": 0,
            "upstreams": [
                {
                    "ip": "1.1.1.1",
                    "port": 80,
                    "weight": 1
                }
            ]
        }
    ]
}
  • Response:
{ "code": 101001 }

更新域名

PUT /api/v1/user/site/{siteID}/domain

描述

根據站點 ID 更新指定 ID 的域名

cURL 範例

curl --request PUT  \
    --header 'Content-Type: application/json' \
    --header "SKC-RefreshToken: {Your Refresh Token}" \
    --header "SKC-AccessToken: {Your Access Token}" \
    --data ' {
        "id": 7,
        "name": "kkk.com",
        "autoSSL": false,
        "forceSSL": false,
        "certificateID": 0,
        "hostName": "kkk.com",
        "status": 0,
        "customHeaderModuleID": 0,
        "urlRedirectModuleID": 0
    }' \
    '{CDNRay API Endpoint}/api/v1/user/site/{siteID}/domain'

詳細內容

  • Payload:
{
    "id": 7,
    "name": "kkk.com",
    "autoSSL": false,
    "forceSSL": false,
    "certificateID": 0,
    "hostName": "kkk.com",
    "status": 0,
    "customHeaderModuleID": 0,
    "urlRedirectModuleID": 0
}
  • Response:
{ "code": 101001 }

刪除域名

DELETE /api/v1/user/site/{siteID}/domains

描述

根據指定的 IDs 刪除複數域名

cURL 範例

curl --request DELETE \
    --header 'Content-Type: application/json' \
    --header "SKC-RefreshToken: {Your Refresh Token}" \
    --header "SKC-AccessToken: {Your Access Token}" \
    --data '{ "ids":[1,2,3,8] }' \
    '{CDNRay API Endpoint}/api/v1/user/site/{siteID}/domains'

詳細內容

  • Payload:
{ "ids":[1,2,3,8] }
  • Response:
{ "code": 101001 }
iconiconiconiconicon