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 = client.iam.users.update(
user_id=0,
)
print(user.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"),
)
user, err := client.Iam.Users.Update(
context.TODO(),
0,
iam.UserUpdateParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", user.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."
}
}Update user's details
This method updates user’s details.
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 = client.iam.users.update(
user_id=0,
)
print(user.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"),
)
user, err := client.Iam.Users.Update(
context.TODO(),
0,
iam.UserUpdateParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", user.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
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
User's ID.
Body
User's email address.
User's name.
User's language.
Defines language of the control panel and email messages.
de, en, ru, zh, az User's phone.
System field. List of auth types available for the account.
Auth types.
password, sso, github, google-oauth2 Response
OK.
User's ID.
User's email address.
User's name.
User's language.
Defines language of the control panel and email messages.
de, en, ru, zh, az User's phone.
User's company.
Services provider ID.
User's account ID.
Deletion flag. If true then user was deleted.
User's group in the current account.
IAM supports 5 groups:
- Users
- Administrators
- Engineers
- Purge and Prefetch only (API)
- Purge and Prefetch only (API+Web)
Show child attributes
Show child attributes
Email confirmation:
true– user confirmed the email;false– user did not confirm the email.
SSO authentication flag. If true then user can login via SAML SSO.
Two-step verification:
true– user enabled two-step verification;false– user disabled two-step verification.
System field. List of auth types available for the account.
Auth types.
password, sso, github, google-oauth2 User's type.
common, reseller, seller User activity flag.
List of user's clients. User can access to one or more clients.
Show child attributes
Show child attributes
Was this page helpful?