搜尋⋯
on

API 白名單操作

API Token Headers

以下 API 皆需 API Token 相關 Header

  • SKC-RefreshToken
  • SKC-AccessToken

取得白名單列表

GET /api/v1/user/site/{siteID}/firewall/setting/whitelists

描述

根據站點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}/firewall/setting/whitelists'

詳細內容

  • Response:
{
    "code": 101001,
    "data": [
        {
            "id": 1,
            "ips": [
                "1.1.1.2"
            ],
            "url": "kkk3.com",
            "methods": {
                "get": true,
                "post": true,
                "put": true,
                "delete": true,
                "head": true,
                "patch": true,
                "options": true
            }
        }
    ]
}

新增白名單

POST /api/v1/user/site/{siteID}/firewall/setting/whitelists

描述

根據站點ID新增數個白名單。

cURL 範例

curl --request POST \
    --header 'Content-Type: application/json' \
    --header "SKC-RefreshToken: {Your Refresh Token}" \
    --header "SKC-AccessToken: {Your Access Token}" \
    --data '{
        "data": [
            {
                "ips": ["1.1.1.2"],
                "url": "kkk3.com",
                "methods": {
                    "get": true,
                    "post": true,
                    "put": true,
                    "delete": true,
                    "head": true,
                    "patch": true,
                    "options": true
                },
                "blockType": 2
            }
        ]
    }' \
    '{CDNRay API Endpoint}/api/v1/user/site/{siteID}/firewall/setting/whitelists'

詳細內容

  • Payload:
{
    "data": [
        {
            "ips": ["1.1.1.2"],
            "url": "kkk3.com",
            "methods": {
                "get": true,
                "post": true,
                "put": true,
                "delete": true,
                "head": true,
                "patch": true,
                "options": true
            },
            "blockType": 2
        }
    ]
}
  • Response:
{ "code": 101001 }

更新白名單

PUT /api/v1/user/site/{siteID}/firewall/setting/whitelist

描述

根據站點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":1,
        "ips": [
            "1.1.1.1"
        ],
        "url": "kkk.com",
        "methods": {
            "get": true,
            "post": true,
            "put": true,
            "delete": true,
            "head": true,
            "patch": true,
            "options": true
        },
        "blockType": 2
    }' \
    '{CDNRay API Endpoint}/api/v1/user/site/{siteID}/firewall/setting/whitelist'

詳細內容

  • Payload:
{
    "id":1,
    "ips": [
        "1.1.1.1"
    ],
    "url": "kkk.com",
    "methods": {
        "get": true,
        "post": true,
        "put": true,
        "delete": true,
        "head": true,
        "patch": true,
        "options": true
    },
    "blockType": 2
}
  • Response:
{ "code": 101001 }

刪除白名單

DELETE /api/v1/user/site/{siteID}/firewall/setting/whitelists

描述

根據指定的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}/firewall/setting/whitelists'

詳細內容

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