更改用户角色

PUT
https://www.digicert.com/services/v2/user/{{user_id}}/role

使用此端点更新用户的访问角色。

要获取对用户可用的访问角色,请使用列出容器角色端点。

cURL
curl -X PUT \
  https://www.digicert.com/services/v2/user/{{user_id}}/role \
  -H 'Content-Type: application/json' \
  -H 'X-DC-DEVKEY: {{api_key}}' \
  -d '{
  "access_roles": [
    {
      "id": 1
    }
  ]
}'
Python
import requests

url = "https://www.digicert.com/services/v2/user/{{user_id}}/role"

payload = "{\n  \"access_roles\": [\n    {\n      \"id\": 1\n    }\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/user/{{user_id}}/role"

	payload := strings.NewReader("{\n  \"access_roles\": [\n    {\n      \"id\": 1\n    }\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/user/{{user_id}}/role',
  headers: 
   { 'Content-Type': 'application/json',
     'X-DC-DEVKEY': '{{api_key}}' },
  body: { access_roles: [ { id: 1 } ] },
  json: true };

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

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

请求参数

名称 请求/选项 类型 描述
access_roles 必填 array 访问角色 ID 的容器。
.. id 必填 int 要更新用户的访问角色的 ID。
请参阅词汇表 - 访问角色