curl --request POST \
--url https://cloud.cdata.com/api/v1/admin/users/{id}/roles \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"role_id": "00000000-0000-0000-0000-000000000010"
}
'import requests
url = "https://cloud.cdata.com/api/v1/admin/users/{id}/roles"
payload = { "role_id": "00000000-0000-0000-0000-000000000010" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({role_id: '00000000-0000-0000-0000-000000000010'})
};
fetch('https://cloud.cdata.com/api/v1/admin/users/{id}/roles', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://cloud.cdata.com/api/v1/admin/users/{id}/roles",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'role_id' => '00000000-0000-0000-0000-000000000010'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://cloud.cdata.com/api/v1/admin/users/{id}/roles"
payload := strings.NewReader("{\n \"role_id\": \"00000000-0000-0000-0000-000000000010\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://cloud.cdata.com/api/v1/admin/users/{id}/roles")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"role_id\": \"00000000-0000-0000-0000-000000000010\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud.cdata.com/api/v1/admin/users/{id}/roles")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"role_id\": \"00000000-0000-0000-0000-000000000010\"\n}"
response = http.request(request)
puts response.read_bodyユーザーにロールを割り当て
Assign the account-wide admin system role directly to a user. Only the admin role is assignable via this endpoint. All other system roles are workspace-scoped and must be assigned via POST /users/{id}/workspaces/{workspace_id}/roles. For group-based assignment use POST /groups/{id}/roles. This endpoint is idempotent: if the role is already assigned, the existing assignment is returned with HTTP 200.
curl --request POST \
--url https://cloud.cdata.com/api/v1/admin/users/{id}/roles \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"role_id": "00000000-0000-0000-0000-000000000010"
}
'import requests
url = "https://cloud.cdata.com/api/v1/admin/users/{id}/roles"
payload = { "role_id": "00000000-0000-0000-0000-000000000010" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({role_id: '00000000-0000-0000-0000-000000000010'})
};
fetch('https://cloud.cdata.com/api/v1/admin/users/{id}/roles', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://cloud.cdata.com/api/v1/admin/users/{id}/roles",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'role_id' => '00000000-0000-0000-0000-000000000010'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://cloud.cdata.com/api/v1/admin/users/{id}/roles"
payload := strings.NewReader("{\n \"role_id\": \"00000000-0000-0000-0000-000000000010\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://cloud.cdata.com/api/v1/admin/users/{id}/roles")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"role_id\": \"00000000-0000-0000-0000-000000000010\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud.cdata.com/api/v1/admin/users/{id}/roles")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"role_id\": \"00000000-0000-0000-0000-000000000010\"\n}"
response = http.request(request)
puts response.read_body承認
The access token received from the authorization server in the OAuth 2.0 flow.
パスパラメータ
User identifier (UUID).
ボディ
Role to assign. Must exist in the organization.
レスポンス
OK. The role is already assigned; returns the existing assignment.
A direct role assignment made via POST /users/{id}/roles.
Assignment identifier.
The user this role is assigned to.
The role identifier.
The name of the role.
Always system_role (admin) for assignments made via this endpoint.
system_role Always direct for assignments made via this endpoint.
direct ISO 8601 UTC.
The user who granted the role.
このページは役に立ちましたか?