更新用户分配

PUT
https://www.digicert.com/services/v2/container/{{container_id}}/user-assignments

使用此端点更新容器的用户分配。

此端点对 user_id_assignments 数组具有破坏性。现有数组将被发送的新数组覆盖。

cURL
curl -X PUT \
  'https://www.digicert.com/services/v2/container/{{container_id}}/user-assignments' \
  -H 'Content-Type: application/json' \
  -H 'X-DC-DEVKEY: {{api_key}}' \
  -d '{
    "user_id_assignments": [
        12345,
        12346
    ]
}'
Python
import requests

url = "https://www.digicert.com/services/v2/container/{{container_id}}/user-assignments"

payload = "{\n    \"user_id_assignments\": [\n        12345,\n        12346\n    ]\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/container/{{container_id}}/user-assignments"

	payload := strings.NewReader("{\n    \"user_id_assignments\": [\n        12345,\n        12346\n    ]\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/container/{{container_id}}/user-assignments',
  headers: 
   { 'Content-Type': 'application/json',
     'X-DC-DEVKEY': '{{api_key}}' },
  body: { user_id_assignments: [ 12345, 12346 ] },
  json: true };

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

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

发送空数组将清除容器的所有用户分配。

请求参数

名称 请求/选项 类型 描述
user_id_assignments 必填 array 分配给容器的用户 ID 的列表。