Skip to main content
PATCH
/
cloud
/
v1
/
users
/
assignments
/
{assignment_id}
Update role assignment
curl --request PATCH \
  --url https://api.gcore.com/cloud/v1/users/assignments/{assignment_id} \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "user_id": 777,
  "client_id": 8,
  "project_id": null
}
'
import requests

url = "https://api.gcore.com/cloud/v1/users/assignments/{assignment_id}"

payload = {
"user_id": 777,
"client_id": 8,
"project_id": None
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({user_id: 777, client_id: 8, project_id: null})
};

fetch('https://api.gcore.com/cloud/v1/users/assignments/{assignment_id}', 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://api.gcore.com/cloud/v1/users/assignments/{assignment_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'user_id' => 777,
'client_id' => 8,
'project_id' => null
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://api.gcore.com/cloud/v1/users/assignments/{assignment_id}"

payload := strings.NewReader("{\n \"user_id\": 777,\n \"client_id\": 8,\n \"project_id\": null\n}")

req, _ := http.NewRequest("PATCH", url, payload)

req.Header.Add("Authorization", "<api-key>")
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.patch("https://api.gcore.com/cloud/v1/users/assignments/{assignment_id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"user_id\": 777,\n \"client_id\": 8,\n \"project_id\": null\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.gcore.com/cloud/v1/users/assignments/{assignment_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"user_id\": 777,\n \"client_id\": 8,\n \"project_id\": null\n}"

response = http.request(request)
puts response.read_body
{
  "assignment_id": 12
}

Authorizations

Authorization
string
header
required

API key for authentication. Make sure to include the word apikey, followed by a single space and then your token. Example: apikey 1234$abcdef

Path Parameters

assignment_id
integer
required

Assignment ID

Example:

123

Body

application/json
role
enum<string>
required

User role

Available options:
ClientAdministrator,
InternalNetworkOnlyUser,
Observer,
ProjectAdministrator,
User
Example:

"ClientAdministrator"

user_id
integer
required

User ID

Example:

777

client_id
integer | null

Client ID. Required if project_id is specified

Example:

8

project_id
integer | null

Project ID

Example:

null

Response

200 - application/json

OK

assignment_id
integer
required

Assignment ID

Example:

12