DigiCert 服务 API 是一个功能强大的 API,可用于自动完成标准证书流程,以节省时间和优化证书管理。服务 API 使用最新的 RESTful 规范且使用简单。
创建 API 请求时使用此基本 URL:
https://www.digicert.com/services/v2
每个端点页面仅提供端点 URL 的最后一部分(例如,/orders)。在创建请求时,请务必假装基本 URL 为端点。
一些端点使用 URL 查询字符串筛选结果。URL 查询字符串通过 ? 追加在端点 URL 上。,通过 & 追加附加查询字符串。
该示例使用 container_id
查询字符串将结果筛选到指定容器。它还使用 limit
查询字符串仅返回 10 个结果。
https://www.digicert.com/services/v2/user?container_id=123&limit=10
所有 API 请求使用 REST 功能通过 RESTful URL 提交,包括基于标头的身份验证和 JSON/XML 请求类型。
请求的数据字符集编码是 UTF-8。一个格式标准的请求使用端口 443 并且指定用户代理和内容长度标头。
DigiCert 服务 API 使用这些标准 HTTP 方法:
GET
POST
PUT
HEAD
DELETE
大多数请求要求传递 JSON 或 XML 格式的数据。如果端点支持或要求不同格式,将对该端点注明。
支持的内容-类型值包括:
application/json
application/xml
image/jpeg
image/png
响应包括标头和正文。正文格式基于在请求中指定的内容-类型值。
请参阅词汇表 - 标头,了解有关 HTTP 标头响应代码的信息。
curl -X POST \
'https://www.digicert.com/services/v2/order/certificate/{{order_id}}/note' \
-H 'Content-Type: application/json' \
-H 'X-DC-DEVKEY: {{api_key}}' \
-d '{
"text": "This is a note"
}'
import requests
url = "https://www.digicert.com/services/v2/order/certificate/{{order_id}}/note"
payload = "{\n\t\"text\": \"This is a note\"\n}"
headers = {
'X-DC-DEVKEY': "{{api_key}}",
'Content-Type': "application/xml"
}
response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://www.digicert.com/services/v2/order/certificate/{{order_id}}/note"
payload := strings.NewReader("{\n\t\"text\": \"This is a note\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-DC-DEVKEY", "{{api_key}}")
req.Header.Add("Content-Type", "application/xml")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
var request = require("request");
var options = { method: 'POST',
url: 'https://www.digicert.com/services/v2/order/certificate/{{order_id}}/note',
headers:
{ 'Content-Type': 'application/xml',
'X-DC-DEVKEY': '{{api_key}}' },
body: '{\n\t"text": "This is a note"\n}' };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
{
"id": 1,
"date_created": "2018-09-26T20:29:09+00:00",
"text": "This is a note",
"user": {
"id": 125039,
"first_name": "John",
"last_name": "Smith",
"email": "john.smith@digicert.com"
}
}
curl -X GET \
'https://www.digicert.com/services/v2/order/certificate/{{order_id}}/note' \
-H 'Content-Type: application/json' \
-H 'X-DC-DEVKEY: {{api_key}}'
import requests
url = "https://www.digicert.com/services/v2/order/certificate/{{order_id}}/note"
headers = {
'X-DC-DEVKEY': "{{api_key}}",
'Content-Type': "application/xml"
}
response = requests.request("GET", url, headers=headers)
print(response.text)
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://www.digicert.com/services/v2/order/certificate/{{order_id}}/note"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-DC-DEVKEY", "{{api_key}}")
req.Header.Add("Content-Type", "application/xml")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
var request = require("request");
var options = { method: 'GET',
url: 'https://www.digicert.com/services/v2/order/certificate/{{order_id}}/note',
headers:
{ 'Content-Type': 'application/xml',
'X-DC-DEVKEY': '{{api_key}}' } };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
{
"notes": [
{
"id": 1,
"date_created": "2018-09-26T20:29:09+00:00",
"text": "This is a note",
"user": {
"id": 125039,
"first_name": "John",
"last_name": "Smith",
"email": "john.smith@digicert.com"
}
}
]
}
curl -X DELETE \
'https://www.digicert.com/services/v2/order/certificate/{{order_id}}/note/{{note_id}}' \
-H 'Content-Type: application/json' \
-H 'X-DC-DEVKEY: {{api_key}}'
import requests
url = "https://www.digicert.com/services/v2/order/certificate/{{order_id}}/note/{{note_id}}"
headers = {
'X-DC-DEVKEY': "{{api_key}}",
'Content-Type': "application/xml"
}
response = requests.request("DELETE", url, headers=headers)
print(response.text)
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://www.digicert.com/services/v2/order/certificate/{{order_id}}/note/{{note_id}}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("X-DC-DEVKEY", "{{api_key}}")
req.Header.Add("Content-Type", "application/xml")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
var request = require("request");
var options = { method: 'DELETE',
url: 'https://www.digicert.com/services/v2/order/certificate/{{order_id}}/note/{{note_id}}',
headers:
{ 'Content-Type': 'application/xml',
'X-DC-DEVKEY': '{{api_key}}' } };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
// empty