變更 DCV 方法

PUT
https://www.digicert.com/services/v2/domain/{{domain_id}}/dcv/method

使用此端點設定網域的網域控制驗證 (DCV) 方法。

cURL
curl -X PUT \
  'https://www.digicert.com/services/v2/domain/{{domain_id}}/dcv/method' \
  -H 'Content-Type: application/json' \
  -H 'X-DC-DEVKEY: {{api_key}}' \
  -d '{
	"dcv_method": "<dcv_method>"
}'
Python
import requests

url = "https://www.digicert.com/services/v2/domain/{{domain_id}}/dcv/method"

payload = "{\n\t\"dcv_method\": \"<dcv_method>\"\n}"
headers = {
    'X-DC-DEVKEY': "{{api_key}}",
    'Content-Type': "application/json"
    }

response = requests.request("PUT", url, data=payload, headers=headers)

print(response.text)
Go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://www.digicert.com/services/v2/domain/{{domain_id}}/dcv/method"

	payload := strings.NewReader("{\n\t\"dcv_method\": \"<dcv_method>\"\n}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("X-DC-DEVKEY", "{{api_key}}")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
NodeJS
var request = require("request");

var options = { method: 'PUT',
  url: 'https://www.digicert.com/services/v2/domain/{{domain_id}}/dcv/method',
  headers: 
   { 'Content-Type': 'application/json',
     'X-DC-DEVKEY': '{{api_key}}' },
  body: { dcv_method: '<dcv_method>' },
  json: true };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
200 OK (email)
{}
200 OK (dns-cname-token)
{
    "dcv_token": {
        "token": "<random_value>",
        "status": "pending",
        "expiration_date": "2018-11-18T20:35:32+00:00",
        "verification_value": "dcv.digicert.com"
    }
}
200 OK (http-token)
{
    "dcv_token": {
        "token": "<random_value>",
        "status": "pending",
        "expiration_date": "2018-11-18T20:38:45+00:00",
        "http_token_url": "http://example.com/.well-known/pki-validation/<random_file_name>.txt"
    }
}
200 OK (dns-txt-token)
{
    "dcv_token": {
        "token": "<random_value>",
        "status": "pending",
        "expiration_date": "2018-11-18T20:40:43+00:00"
    }
}

要求參數

名稱 必填/選填 類型 說明
dcv_method 必填 string 要用於網域的 DCV 方法。
請參閱詞彙 — DCV 方法

回應參數

名稱 類型 說明
dcv_token string 物件包含與 DCV 方法範圍有關的資訊。
.. token string 用於證明有網域的控制權的隨機值。
.. status string 網域驗證的狀態。
.. expiration_date string DCV 權杖到期時的時間戳記。
格式:UTC 時區和 ISO 8601 日期
.. verification_value string DNS 記錄目標主機欄位的值
僅在 DCV 方法是 dns-cname-token 時傳回。
.. http_token_url string .txt 檔案的檔案名稱和位置
僅在 DCV 方法是 http-token 時傳回。