编辑自定义字段

POST
https://www.digicert.com/services/v2/order/certificate/{{order_id}}/custom-field

使用此端点编辑订单的自定义字段值。请参阅列表自定义字段端点以获取有关自定义字段(包括元数据 ID)的详细信息。

当值的数据类型与自定义字段允许的数据类型不匹配时,返回 invalid_custom_field_value

cURL
curl -X POST \
  'https://www.digicert.com/services/v2/order/certificate/{{order_id}}/custom-field' \
  -H 'Content-Type: application/json' \
  -H 'X-DC-DEVKEY: {{api_key}}' \
  -d '{
  "metadata_id": 276,
  "value": "New value"
}'
Python
import requests

url = "https://www.digicert.com/services/v2/order/certificate/{{order_id}}/custom-field"

payload = "{\n  \"metadata_id\": 276,\n  \"value\": \"New value\"\n}"
headers = {
    'X-DC-DEVKEY': "{{api_key}}",
    'Content-Type': "application/json"
    }

response = requests.request("POST", 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/order/certificate/{{order_id}}/custom-field"

	payload := strings.NewReader("{\n  \"metadata_id\": 276,\n  \"value\": \"New value\"\n}")

	req, _ := http.NewRequest("POST", 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: 'POST',
  url: 'https://www.digicert.com/services/v2/order/certificate/{{order_id}}/custom-field',
  headers: 
   { 'Content-Type': 'application/json',
     'X-DC-DEVKEY': '{{api_key}}' },
  body: { metadata_id: 276, value: 'New value' },
  json: true };

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

  console.log(body);
});
204 No Content
// empty

请求参数

名称 请求/选项 类型 描述
metadata_id 必填 int 指定要更新的自定义字段的元数据 ID。
value 必填 string 自定义字段的新值。