// Create a user returns null access role
packagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV1")funcmain(){body:=datadogV1.User{AccessRole:*datadogV1.NewNullableAccessRole(nil),Disabled:datadog.PtrBool(false),Email:datadog.PtrString("test@datadoghq.com"),Handle:datadog.PtrString("test@datadoghq.com"),Name:datadog.PtrString("test user"),}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV1.NewUsersApi(apiClient)resp,r,err:=api.CreateUser(ctx,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `UsersApi.CreateUser`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `UsersApi.CreateUser`:\n%s\n",responseContent)}
"""
Create a user returns null access role
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v1.api.users_apiimportUsersApifromdatadog_api_client.v1.model.userimportUserbody=User(access_role=None,disabled=False,email="test@datadoghq.com",handle="test@datadoghq.com",name="test user",)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=UsersApi(api_client)response=api_instance.create_user(body=body)print(response)
# Create a user returns null access rolerequire"datadog_api_client"api_instance=DatadogAPIClient::V1::UsersAPI.newbody=DatadogAPIClient::V1::User.new({access_role:nil,disabled:false,email:"test@datadoghq.com",handle:"test@datadoghq.com",name:"test user",})papi_instance.create_user(body)
// Create a user returns null access role
usedatadog_api_client::datadog;usedatadog_api_client::datadogV1::api_users::UsersAPI;usedatadog_api_client::datadogV1::model::User;#[tokio::main]asyncfnmain(){letbody=User::new().access_role(None).disabled(false).email("test@datadoghq.com".to_string()).handle("test@datadoghq.com".to_string()).name("test user".to_string());letconfiguration=datadog::Configuration::new();letapi=UsersAPI::with_config(configuration);letresp=api.create_user(body).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<API-KEY>"DD_APP_KEY="<APP-KEY>"cargo run
/**
* Create a user returns null access role
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.UsersApi(configuration);constparams: v1.UsersApiCreateUserRequest={body:{accessRole: undefined,disabled: false,email:"test@datadoghq.com",handle:"test@datadoghq.com",name:"test user",},};apiInstance.createUser(params).then((data: v1.UserResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
// Create a user returns "OK" response
packagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){body:=datadogV2.UserCreateRequest{Data:datadogV2.UserCreateData{Type:datadogV2.USERSTYPE_USERS,Attributes:datadogV2.UserCreateAttributes{Name:datadog.PtrString("Datadog API Client Python"),Email:"Example-User@datadoghq.com",},},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewUsersApi(apiClient)resp,r,err:=api.CreateUser(ctx,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `UsersApi.CreateUser`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `UsersApi.CreateUser`:\n%s\n",responseContent)}
// Create a user returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.UsersApi;importcom.datadog.api.client.v2.model.UserCreateAttributes;importcom.datadog.api.client.v2.model.UserCreateData;importcom.datadog.api.client.v2.model.UserCreateRequest;importcom.datadog.api.client.v2.model.UserResponse;importcom.datadog.api.client.v2.model.UsersType;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();UsersApiapiInstance=newUsersApi(defaultClient);UserCreateRequestbody=newUserCreateRequest().data(newUserCreateData().type(UsersType.USERS).attributes(newUserCreateAttributes().name("Datadog API Client Python").email("Example-User@datadoghq.com")));try{UserResponseresult=apiInstance.createUser(body);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling UsersApi#createUser");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
"""
Create a user returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.users_apiimportUsersApifromdatadog_api_client.v2.model.user_create_attributesimportUserCreateAttributesfromdatadog_api_client.v2.model.user_create_dataimportUserCreateDatafromdatadog_api_client.v2.model.user_create_requestimportUserCreateRequestfromdatadog_api_client.v2.model.users_typeimportUsersTypebody=UserCreateRequest(data=UserCreateData(type=UsersType.USERS,attributes=UserCreateAttributes(name="Datadog API Client Python",email="Example-User@datadoghq.com",),),)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=UsersApi(api_client)response=api_instance.create_user(body=body)print(response)
# Create a user returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::UsersAPI.newbody=DatadogAPIClient::V2::UserCreateRequest.new({data:DatadogAPIClient::V2::UserCreateData.new({type:DatadogAPIClient::V2::UsersType::USERS,attributes:DatadogAPIClient::V2::UserCreateAttributes.new({name:"Datadog API Client Python",email:"Example-User@datadoghq.com",}),}),})papi_instance.create_user(body)
// Create a user returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_users::UsersAPI;usedatadog_api_client::datadogV2::model::UserCreateAttributes;usedatadog_api_client::datadogV2::model::UserCreateData;usedatadog_api_client::datadogV2::model::UserCreateRequest;usedatadog_api_client::datadogV2::model::UsersType;#[tokio::main]asyncfnmain(){letbody=UserCreateRequest::new(UserCreateData::new(UserCreateAttributes::new("Example-User@datadoghq.com".to_string()).name("Datadog API Client Python".to_string()),UsersType::USERS,));letconfiguration=datadog::Configuration::new();letapi=UsersAPI::with_config(configuration);letresp=api.create_user(body).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Create a user returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.UsersApi(configuration);constparams: v2.UsersApiCreateUserRequest={body:{data:{type:"users",attributes:{name:"Datadog API Client Python",email:"Example-User@datadoghq.com",},},},};apiInstance.createUser(params).then((data: v2.UserResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
"""
List all users returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v1.api.users_apiimportUsersApiconfiguration=Configuration()withApiClient(configuration)asapi_client:api_instance=UsersApi(api_client)response=api_instance.list_users()print(response)
// List all users returns "OK" response
packagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV1")funcmain(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV1.NewUsersApi(apiClient)resp,r,err:=api.ListUsers(ctx)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `UsersApi.ListUsers`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `UsersApi.ListUsers`:\n%s\n",responseContent)}
// List all users returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v1.api.UsersApi;importcom.datadog.api.client.v1.model.UserListResponse;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();UsersApiapiInstance=newUsersApi(defaultClient);try{UserListResponseresult=apiInstance.listUsers();System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling UsersApi#listUsers");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// List all users returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV1::api_users::UsersAPI;#[tokio::main]asyncfnmain(){letconfiguration=datadog::Configuration::new();letapi=UsersAPI::with_config(configuration);letresp=api.list_users().await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* List all users returns "OK" response
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.UsersApi(configuration);apiInstance.listUsers().then((data: v1.UserListResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
Énumérez tous les utilisateurs de votre organisation.
This endpoint requires the user_access_read authorization scope.
Arguments
Chaînes de requête
Nom
Type
Description
page[size]
integer
Size for a given page. The maximum allowed value is 100.
page[number]
integer
Specific page number to return.
sort
string
User attribute to order results by. Sort order is ascending by default.
Sort order is descending if the field
is prefixed by a negative sign, for example sort=-name. Options: name,
modified_at, user_count.
sort_dir
enum
Direction of sort. Options: asc, desc. Allowed enum values: asc, desc
filter
string
Filter all users by the given string. Defaults to no filtering.
filter[status]
string
Filter on status attribute.
Comma separated list, with possible values Active, Pending, and Disabled.
Defaults to no filtering.
"""
List all users returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.users_apiimportUsersApi# there is a valid "user" in the systemUSER_DATA_ATTRIBUTES_EMAIL=environ["USER_DATA_ATTRIBUTES_EMAIL"]configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=UsersApi(api_client)response=api_instance.list_users(filter=USER_DATA_ATTRIBUTES_EMAIL,)print(response)
# List all users returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::UsersAPI.new# there is a valid "user" in the systemUSER_DATA_ATTRIBUTES_EMAIL=ENV["USER_DATA_ATTRIBUTES_EMAIL"]opts={filter:USER_DATA_ATTRIBUTES_EMAIL,}papi_instance.list_users(opts)
// List all users returns "OK" response
packagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){// there is a valid "user" in the system
UserDataAttributesEmail:=os.Getenv("USER_DATA_ATTRIBUTES_EMAIL")ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewUsersApi(apiClient)resp,r,err:=api.ListUsers(ctx,*datadogV2.NewListUsersOptionalParameters().WithFilter(UserDataAttributesEmail))iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `UsersApi.ListUsers`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `UsersApi.ListUsers`:\n%s\n",responseContent)}
// List all users returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.UsersApi;importcom.datadog.api.client.v2.api.UsersApi.ListUsersOptionalParameters;importcom.datadog.api.client.v2.model.UsersResponse;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();UsersApiapiInstance=newUsersApi(defaultClient);// there is a valid "user" in the systemStringUSER_DATA_ATTRIBUTES_EMAIL=System.getenv("USER_DATA_ATTRIBUTES_EMAIL");try{UsersResponseresult=apiInstance.listUsers(newListUsersOptionalParameters().filter(USER_DATA_ATTRIBUTES_EMAIL));System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling UsersApi#listUsers");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// List all users returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_users::ListUsersOptionalParams;usedatadog_api_client::datadogV2::api_users::UsersAPI;#[tokio::main]asyncfnmain(){// there is a valid "user" in the system
letuser_data_attributes_email=std::env::var("USER_DATA_ATTRIBUTES_EMAIL").unwrap();letconfiguration=datadog::Configuration::new();letapi=UsersAPI::with_config(configuration);letresp=api.list_users(ListUsersOptionalParams::default().filter(user_data_attributes_email.clone())).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* List all users returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.UsersApi(configuration);// there is a valid "user" in the system
constUSER_DATA_ATTRIBUTES_EMAIL=process.env.USER_DATA_ATTRIBUTES_EMAILasstring;constparams: v2.UsersApiListUsersRequest={filter: USER_DATA_ATTRIBUTES_EMAIL,};apiInstance.listUsers(params).then((data: v2.UsersResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
"""
Get user details returns "OK for get user" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v1.api.users_apiimportUsersApiconfiguration=Configuration()withApiClient(configuration)asapi_client:api_instance=UsersApi(api_client)response=api_instance.get_user(user_handle="test@datadoghq.com",)print(response)
# Get user details returns "OK for get user" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::UsersAPI.newpapi_instance.get_user("test@datadoghq.com")
// Get user details returns "OK for get user" response
packagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV1")funcmain(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV1.NewUsersApi(apiClient)resp,r,err:=api.GetUser(ctx,"test@datadoghq.com")iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `UsersApi.GetUser`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `UsersApi.GetUser`:\n%s\n",responseContent)}
// Get user details returns "OK for get user" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v1.api.UsersApi;importcom.datadog.api.client.v1.model.UserResponse;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();UsersApiapiInstance=newUsersApi(defaultClient);try{UserResponseresult=apiInstance.getUser("test@datadoghq.com");System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling UsersApi#getUser");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Get user details returns "OK for get user" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV1::api_users::UsersAPI;#[tokio::main]asyncfnmain(){letconfiguration=datadog::Configuration::new();letapi=UsersAPI::with_config(configuration);letresp=api.get_user("test@datadoghq.com".to_string()).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<API-KEY>"DD_APP_KEY="<APP-KEY>"cargo run
/**
* Get user details returns "OK for get user" response
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.UsersApi(configuration);constparams: v1.UsersApiGetUserRequest={userHandle:"test@datadoghq.com",};apiInstance.getUser(params).then((data: v1.UserResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
"""
Get user details returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.users_apiimportUsersApi# there is a valid "user" in the systemUSER_DATA_ID=environ["USER_DATA_ID"]configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=UsersApi(api_client)response=api_instance.get_user(user_id=USER_DATA_ID,)print(response)
# Get user details returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::UsersAPI.new# there is a valid "user" in the systemUSER_DATA_ID=ENV["USER_DATA_ID"]papi_instance.get_user(USER_DATA_ID)
// Get user details returns "OK" response
packagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){// there is a valid "user" in the system
UserDataID:=os.Getenv("USER_DATA_ID")ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewUsersApi(apiClient)resp,r,err:=api.GetUser(ctx,UserDataID)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `UsersApi.GetUser`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `UsersApi.GetUser`:\n%s\n",responseContent)}
// Get user details returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.UsersApi;importcom.datadog.api.client.v2.model.UserResponse;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();UsersApiapiInstance=newUsersApi(defaultClient);// there is a valid "user" in the systemStringUSER_DATA_ID=System.getenv("USER_DATA_ID");try{UserResponseresult=apiInstance.getUser(USER_DATA_ID);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling UsersApi#getUser");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Get user details returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_users::UsersAPI;#[tokio::main]asyncfnmain(){// there is a valid "user" in the system
letuser_data_id=std::env::var("USER_DATA_ID").unwrap();letconfiguration=datadog::Configuration::new();letapi=UsersAPI::with_config(configuration);letresp=api.get_user(user_data_id.clone()).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Get user details returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.UsersApi(configuration);// there is a valid "user" in the system
constUSER_DATA_ID=process.env.USER_DATA_IDasstring;constparams: v2.UsersApiGetUserRequest={userId: USER_DATA_ID,};apiInstance.getUser(params).then((data: v2.UserResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
"""
Update a user returns "User updated" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v1.api.users_apiimportUsersApifromdatadog_api_client.v1.model.access_roleimportAccessRolefromdatadog_api_client.v1.model.userimportUserbody=User(access_role=AccessRole.READ_ONLY,disabled=False,email="test@datadoghq.com",handle="test@datadoghq.com",name="test user",)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=UsersApi(api_client)response=api_instance.update_user(user_handle="test@datadoghq.com",body=body)print(response)
# Update a user returns "User updated" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::UsersAPI.newbody=DatadogAPIClient::V1::User.new({access_role:DatadogAPIClient::V1::AccessRole::READ_ONLY,disabled:false,email:"test@datadoghq.com",handle:"test@datadoghq.com",name:"test user",})papi_instance.update_user("test@datadoghq.com",body)
// Update a user returns "User updated" response
packagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV1")funcmain(){body:=datadogV1.User{AccessRole:*datadogV1.NewNullableAccessRole(datadogV1.ACCESSROLE_READ_ONLY.Ptr()),Disabled:datadog.PtrBool(false),Email:datadog.PtrString("test@datadoghq.com"),Handle:datadog.PtrString("test@datadoghq.com"),Name:datadog.PtrString("test user"),}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV1.NewUsersApi(apiClient)resp,r,err:=api.UpdateUser(ctx,"test@datadoghq.com",body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `UsersApi.UpdateUser`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `UsersApi.UpdateUser`:\n%s\n",responseContent)}
// Update a user returns "User updated" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV1::api_users::UsersAPI;usedatadog_api_client::datadogV1::model::AccessRole;usedatadog_api_client::datadogV1::model::User;#[tokio::main]asyncfnmain(){letbody=User::new().access_role(Some(AccessRole::READ_ONLY)).disabled(false).email("test@datadoghq.com".to_string()).handle("test@datadoghq.com".to_string()).name("test user".to_string());letconfiguration=datadog::Configuration::new();letapi=UsersAPI::with_config(configuration);letresp=api.update_user("test@datadoghq.com".to_string(),body).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<API-KEY>"DD_APP_KEY="<APP-KEY>"cargo run
/**
* Update a user returns "User updated" response
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.UsersApi(configuration);constparams: v1.UsersApiUpdateUserRequest={body:{accessRole:"ro",disabled: false,email:"test@datadoghq.com",handle:"test@datadoghq.com",name:"test user",},userHandle:"test@datadoghq.com",};apiInstance.updateUser(params).then((data: v1.UserResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
// Update a user returns "OK" response
packagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){// there is a valid "user" in the system
UserDataID:=os.Getenv("USER_DATA_ID")body:=datadogV2.UserUpdateRequest{Data:datadogV2.UserUpdateData{Id:UserDataID,Type:datadogV2.USERSTYPE_USERS,Attributes:datadogV2.UserUpdateAttributes{Name:datadog.PtrString("updated"),Disabled:datadog.PtrBool(true),},},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewUsersApi(apiClient)resp,r,err:=api.UpdateUser(ctx,UserDataID,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `UsersApi.UpdateUser`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `UsersApi.UpdateUser`:\n%s\n",responseContent)}
// Update a user returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.UsersApi;importcom.datadog.api.client.v2.model.UserResponse;importcom.datadog.api.client.v2.model.UserUpdateAttributes;importcom.datadog.api.client.v2.model.UserUpdateData;importcom.datadog.api.client.v2.model.UserUpdateRequest;importcom.datadog.api.client.v2.model.UsersType;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();UsersApiapiInstance=newUsersApi(defaultClient);// there is a valid "user" in the systemStringUSER_DATA_ID=System.getenv("USER_DATA_ID");UserUpdateRequestbody=newUserUpdateRequest().data(newUserUpdateData().id(USER_DATA_ID).type(UsersType.USERS).attributes(newUserUpdateAttributes().name("updated").disabled(true)));try{UserResponseresult=apiInstance.updateUser(USER_DATA_ID,body);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling UsersApi#updateUser");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
"""
Update a user returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.users_apiimportUsersApifromdatadog_api_client.v2.model.user_update_attributesimportUserUpdateAttributesfromdatadog_api_client.v2.model.user_update_dataimportUserUpdateDatafromdatadog_api_client.v2.model.user_update_requestimportUserUpdateRequestfromdatadog_api_client.v2.model.users_typeimportUsersType# there is a valid "user" in the systemUSER_DATA_ID=environ["USER_DATA_ID"]body=UserUpdateRequest(data=UserUpdateData(id=USER_DATA_ID,type=UsersType.USERS,attributes=UserUpdateAttributes(name="updated",disabled=True,),),)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=UsersApi(api_client)response=api_instance.update_user(user_id=USER_DATA_ID,body=body)print(response)
# Update a user returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::UsersAPI.new# there is a valid "user" in the systemUSER_DATA_ID=ENV["USER_DATA_ID"]body=DatadogAPIClient::V2::UserUpdateRequest.new({data:DatadogAPIClient::V2::UserUpdateData.new({id:USER_DATA_ID,type:DatadogAPIClient::V2::UsersType::USERS,attributes:DatadogAPIClient::V2::UserUpdateAttributes.new({name:"updated",disabled:true,}),}),})papi_instance.update_user(USER_DATA_ID,body)
// Update a user returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_users::UsersAPI;usedatadog_api_client::datadogV2::model::UserUpdateAttributes;usedatadog_api_client::datadogV2::model::UserUpdateData;usedatadog_api_client::datadogV2::model::UserUpdateRequest;usedatadog_api_client::datadogV2::model::UsersType;#[tokio::main]asyncfnmain(){// there is a valid "user" in the system
letuser_data_id=std::env::var("USER_DATA_ID").unwrap();letbody=UserUpdateRequest::new(UserUpdateData::new(UserUpdateAttributes::new().disabled(true).name("updated".to_string()),user_data_id.clone(),UsersType::USERS,));letconfiguration=datadog::Configuration::new();letapi=UsersAPI::with_config(configuration);letresp=api.update_user(user_data_id.clone(),body).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Update a user returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.UsersApi(configuration);// there is a valid "user" in the system
constUSER_DATA_ID=process.env.USER_DATA_IDasstring;constparams: v2.UsersApiUpdateUserRequest={body:{data:{id: USER_DATA_ID,type:"users",attributes:{name:"updated",disabled: true,},},},userId: USER_DATA_ID,};apiInstance.updateUser(params).then((data: v2.UserResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
"""
Disable a user returns "User disabled" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v1.api.users_apiimportUsersApiconfiguration