Python
import os
from gcore import Gcore
client = Gcore(
api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted
)
user_updated = client.iam.users.update(
user_id=0,
)
print(user_updated.id)package main
import (
"context"
"fmt"
"github.com/G-Core/gcore-go"
"github.com/G-Core/gcore-go/iam"
"github.com/G-Core/gcore-go/option"
)
func main() {
client := gcore.NewClient(
option.WithAPIKey("My API Key"),
)
userUpdated, err := client.Iam.Users.Update(
context.TODO(),
0,
iam.UserUpdateParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", userUpdated.ID)
}
curl --request PATCH \
--url https://api.gcore.com/iam/users/{userId} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "jsmith@example.com",
"name": "<string>",
"phone": "<string>",
"auth_types": []
}
'const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
email: 'jsmith@example.com',
name: '<string>',
phone: '<string>',
auth_types: []
})
};
fetch('https://api.gcore.com/iam/users/{userId}', 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/iam/users/{userId}",
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([
'email' => 'jsmith@example.com',
'name' => '<string>',
'phone' => '<string>',
'auth_types' => [
]
]),
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;
}HttpResponse<String> response = Unirest.patch("https://api.gcore.com/iam/users/{userId}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"jsmith@example.com\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"auth_types\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/iam/users/{userId}")
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 \"email\": \"jsmith@example.com\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"auth_types\": []\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"email": "jsmith@example.com",
"name": "<string>",
"lang": "de",
"phone": "<string>",
"company": "<string>",
"reseller": 123,
"client": 123,
"deleted": true,
"groups": [
{
"id": 1,
"name": "Administrators"
}
],
"activated": true,
"sso_auth": true,
"two_fa": true,
"auth_types": [
"password"
],
"user_type": "common",
"is_active": true,
"client_and_roles": [
{
"client_id": 123,
"client_company_name": "<string>",
"user_roles": [
"2"
],
"user_id": 123
}
]
}{
"errors": {
"groups": "Group matching query does not exist."
}
}Users
Update user's details
This method updates user’s details.
PATCH
/
iam
/
users
/
{userId}
Python
import os
from gcore import Gcore
client = Gcore(
api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted
)
user_updated = client.iam.users.update(
user_id=0,
)
print(user_updated.id)package main
import (
"context"
"fmt"
"github.com/G-Core/gcore-go"
"github.com/G-Core/gcore-go/iam"
"github.com/G-Core/gcore-go/option"
)
func main() {
client := gcore.NewClient(
option.WithAPIKey("My API Key"),
)
userUpdated, err := client.Iam.Users.Update(
context.TODO(),
0,
iam.UserUpdateParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", userUpdated.ID)
}
curl --request PATCH \
--url https://api.gcore.com/iam/users/{userId} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "jsmith@example.com",
"name": "<string>",
"phone": "<string>",
"auth_types": []
}
'const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
email: 'jsmith@example.com',
name: '<string>',
phone: '<string>',
auth_types: []
})
};
fetch('https://api.gcore.com/iam/users/{userId}', 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/iam/users/{userId}",
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([
'email' => 'jsmith@example.com',
'name' => '<string>',
'phone' => '<string>',
'auth_types' => [
]
]),
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;
}HttpResponse<String> response = Unirest.patch("https://api.gcore.com/iam/users/{userId}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"jsmith@example.com\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"auth_types\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/iam/users/{userId}")
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 \"email\": \"jsmith@example.com\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"auth_types\": []\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"email": "jsmith@example.com",
"name": "<string>",
"lang": "de",
"phone": "<string>",
"company": "<string>",
"reseller": 123,
"client": 123,
"deleted": true,
"groups": [
{
"id": 1,
"name": "Administrators"
}
],
"activated": true,
"sso_auth": true,
"two_fa": true,
"auth_types": [
"password"
],
"user_type": "common",
"is_active": true,
"client_and_roles": [
{
"client_id": 123,
"client_company_name": "<string>",
"user_roles": [
"2"
],
"user_id": 123
}
]
}{
"errors": {
"groups": "Group matching query does not exist."
}
}Authorizations
Body
application/json
Response
OK.
Was this page helpful?