搜尋⋯
on

API 證書操作

API Token Headers

以下 API 皆需 API Token 相關 Header

  • SKC-RefreshToken
  • SKC-AccessToken

取得證書列表

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

描述

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

詳細內容

  • URL Parameters:
    • page: 頁數
    • pageSize: 每頁顯示數量
  • Response:
{
    "code": 101001,
    "total": 1,
    "data": [
        {
            "createdAt": "2023-08-18T10:17:09.159+08:00",
            "updatedAt": "2023-08-18T10:17:09.159+08:00",
            "id": 2,
            "name": "example.com",
            "csr": "-----BEGIN CERTIFICATE REQUEST-----\nMIICvDCCA...X9maZhPp+6QIDAQAB\n-----END CERTIFICATE REQUEST-----",
            "key": "-----BEGIN PRIVATE KEY-----\nMIIEvAIBADANBgkqh...QeCv74WZ379maZhPp\n-----END PRIVATE KEY-----",
            "isAuto": false,
            "inUseCount": 1,
            "memo": ""
        }
    ]
}

新增證書

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

描述

根據站點 ID 新增一個證書

cURL 範例

curl --request POST \
    --header 'Content-Type: application/json' \
    --header "SKC-RefreshToken: {Your Refresh Token}" \
    --header "SKC-AccessToken: {Your Access Token}" \
    --data '{
        "name": "example.com",
        "csr": "-----BEGIN CERTIFICATE REQUEST-----\nMIICvDCCA...X9maZhPp+6QIDAQAB\n-----END CERTIFICATE REQUEST-----",
        "key": "-----BEGIN PRIVATE KEY-----\nMIIEvAIBADANBgkqh...QeCv74WZ379maZhPp\n-----END PRIVATE KEY-----",
        "domainIDs":[7]
    }' \
    '{CDNRay API Endpoint}/api/v1/user/site/{siteID}/certificate'

詳細內容

  • Payload:
{
    "name": "example.com",
    "csr": "-----BEGIN CERTIFICATE REQUEST-----\nMIICvDCCA...X9maZhPp+6QIDAQAB\n-----END CERTIFICATE REQUEST-----",
    "key": "-----BEGIN PRIVATE KEY-----\nMIIEvAIBADANBgkqh...QeCv74WZ379maZhPp\n-----END PRIVATE KEY-----",
    "domainIDs":[7]
}
  • Response:
{ "code": 101001 }

更新證書

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

描述

根據站點 ID 更新指定 ID 的證書

cURL 範例

curl --request PUT \
    --header 'Content-Type: application/json' \
    --header "SKC-RefreshToken: {Your Refresh Token}" \
    --header "SKC-AccessToken: {Your Access Token}" \
    --data '{
        "name": "example.com",
        "csr": "-----BEGIN CERTIFICATE REQUEST-----\nMIICvDCCA...X9maZhPp+6QIDAQAB\n-----END CERTIFICATE REQUEST-----",
        "key": "-----BEGIN PRIVATE KEY-----\nMIIEvAIBADANBgkqh...QeCv74WZ379maZhPp\n-----END PRIVATE KEY-----",
        "domainIDs":[7],
        "id":2,
        "needUpdateCertificates":false
    }' \
    '{CDNRay API Endpoint}/api/v1/user/site/{siteID}/certificate'

詳細內容

  • Payload:
{
    "name": "example.com",
    "csr": "-----BEGIN CERTIFICATE REQUEST-----\nMIICvDCCA...X9maZhPp+6QIDAQAB\n-----END CERTIFICATE REQUEST-----",
    "key": "-----BEGIN PRIVATE KEY-----\nMIIEvAIBADANBgkqh...QeCv74WZ379maZhPp\n-----END PRIVATE KEY-----",
    "domainIDs":[7],
    "id":2,
    "needUpdateCertificates":false
}
  • Response:
{ "code": 101001 }

刪除證書

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

描述

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

cURL 範例

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

詳細內容

  • Payload:
{ "ids":[2] }
  • Response:
{ "code": 101001 }
iconiconiconiconicon