使用此端点创建新容器。
要获取 template_id
值的列表,请使用列出模板端点。
curl -X POST \
https://www.digicert.com/services/v2/container/{{container_id}}/children \
-H 'Content-Type: application/json' \
-H 'X-DC-DEVKEY: {{api_key}}' \
-d '{
"name": "Sales Department",
"description": "Includes sales engineers",
"template_id": 6
}'
import requests
url = "https://www.digicert.com/services/v2/container/{{container_id}}/children"
payload = "{\n \"name\": \"Sales Department\",\n \"description\": \"Includes sales engineers\",\n \"template_id\": 6\n}"
headers = {
'X-DC-DEVKEY': "{{api_key}}",
'Content-Type': "application/json"
}
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/container/{{container_id}}/children"
payload := strings.NewReader("{\n \"name\": \"Sales Department\",\n \"description\": \"Includes sales engineers\",\n \"template_id\": 6\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))
}
var request = require("request");
var options = { method: 'POST',
url: 'https://www.digicert.com/services/v2/container/{{container_id}}/children',
headers:
{ 'Content-Type': 'application/json',
'X-DC-DEVKEY': '{{api_key}}' },
body:
{ name: 'Sales Department',
description: 'Includes sales engineers',
template_id: 6 },
json: true };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
{
"id": 6
}
名称 | 请求/选项 | 类型 | 描述 |
---|---|---|---|
name | 必填 | string | 容器的名称。 |
description | 可选 | string | 对容器的描述。 |
template_id | 必填 | int |
容器的模板 ID。 有关允许的值,请使用列出模板端点。 |
名称 | 类型 | 描述 |
---|---|---|
id | int | 所创建容器的 ID。 |