使用此端点创建新用户。要获取可用的访问角色,请使用列出容器角色端点。
在默认情况下,创建用户的容器与和请求一起使用的 API 密钥所关联的用户的容器相同。
curl -X POST \
https://www.digicert.com/services/v2/user \
-H 'Content-Type: application/json' \
-H 'X-DC-DEVKEY: {{api_key}}' \
-d '{
"first_name": "Jill",
"last_name": "Valentine",
"email": "jill.valentine@pd.racoon-city.gov",
"telephone": "555-555-5555",
"job_title": "S.T.A.R.S. Alpha Team",
"username": "jill.valentine",
"container": {
"id": 93288
},
"access_roles": [
{
"id": 5
}
]
}'
import requests
url = "https://www.digicert.com/services/v2/user"
payload = "{\n \"first_name\": \"Jill\",\n \"last_name\": \"Valentine\",\n \"email\": \"jill.valentine@pd.racoon-city.gov\",\n \"telephone\": \"555-555-5555\",\n \"job_title\": \"S.T.A.R.S. Alpha Team\",\n \"username\": \"jill.valentine\",\n \"container\": {\n \"id\": 93288\n },\n \"access_roles\": [\n {\n \"id\": 5\n }\n ]\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/user"
payload := strings.NewReader("{\n \"first_name\": \"Jill\",\n \"last_name\": \"Valentine\",\n \"email\": \"jill.valentine@pd.racoon-city.gov\",\n \"telephone\": \"555-555-5555\",\n \"job_title\": \"S.T.A.R.S. Alpha Team\",\n \"username\": \"jill.valentine\",\n \"container\": {\n \"id\": 93288\n },\n \"access_roles\": [\n {\n \"id\": 5\n }\n ]\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/user',
headers:
{ 'Content-Type': 'application/json',
'X-DC-DEVKEY': '{{api_key}}' },
body:
{ first_name: 'Jill',
last_name: 'Valentine',
email: 'jill.valentine@pd.racoon-city.gov',
telephone: '555-555-5555',
job_title: 'S.T.A.R.S. Alpha Team',
username: 'jill.valentine',
container: { id: 93288 },
access_roles: [ { id: 5 } ] },
json: true };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
{
"id": 1538858
}
名称 | 请求/选项 | 类型 | 描述 |
---|---|---|---|
username | 必填 | string |
配置文件的用户名。 有效字符:a—zA—Z0—9@-_+. |
first_name | 必填 | string |
用户的名字。 字符长度限制:128 |
last_name | 必填 | string |
用户的姓氏。 字符长度限制:128 |
必填 | string |
用户的电子邮件地址。 仅接受有效的电子邮件地址。 字符长度限制:255 |
|
job_title | 可选 | string |
用户的职位名称。 对作为 EV 审批者的用户必填。 字符长度限制:64 |
telephone | 可选 | string |
用户的电话号码。 对作为 EV 审批者的用户必填。 字符长度限制:64 |
container | 必填 | object | |
.. id | 必填 | int | 将在其中创建用户的容器的 ID。 |
access_roles | 必填 | array | |
.. id | 必填 | int |
要指定用户的访问角色的 ID。 请参阅词汇表 - 访问角色 |
container_id_assignments | 必填 | array | 要向其指定用户的容器 ID 的列表。如果设置,这将覆盖用户可以查看的任何默认容器。 |
名称 | 类型 | 描述 |
---|---|---|
id | int | 所创建用户的 ID。 |