搜尋⋯
on

API 黑名單操作

API Token Headers

以下 API 皆需 API Token 相關 Header

  • SKC-RefreshToken
  • SKC-AccessToken

取得黑名單列表

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

描述

根據站點 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/blacklists'

詳細內容

  • Response:
{
    "code": 101001,
    "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
        }
    ]
}

新增黑名單

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

描述

根據站點 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.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/blacklists'

詳細內容

  • Payload:
{
    "data": [
        {
            "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 }

更新黑名單

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

描述

根據站點 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": "kkk2.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/blacklist'

詳細內容

  • Payload:
{
    "id":1,
    "ips": [
        "1.1.1.1"
    ],
    "url": "kkk2.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/blacklists

描述

根據指定的 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/blacklists'

詳細內容

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