This page is not yet available in Spanish. We are working on its translation. If you have any questions or feedback about our current translation project, feel free to reach out to us!
// 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));
Enumera todos los usuarios de tu organización.
This endpoint requires the user_access_read permission.
OAuth apps require the user_access_read authorization scope to access this endpoint.
Argumentos
Cadenas de consulta
Nombre
Tipo
Descripción
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=Configuration()withApiClient(configuration)asapi_client:api_instance=UsersApi(api_client)response=api_instance.disable_user(user_handle="test@datadoghq.com",)print(response)
# Disable a user returns "User disabled" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::UsersAPI.newpapi_instance.disable_user("test@datadoghq.com")
// Disable a user returns "User disabled" 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.DisableUser(ctx,"test@datadoghq.com")iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `UsersApi.DisableUser`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `UsersApi.DisableUser`:\n%s\n",responseContent)}
// Disable a user returns "User disabled" 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.disable_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
/**
* Disable a user returns "User disabled" response
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.UsersApi(configuration);constparams: v1.UsersApiDisableUserRequest={userHandle:"test@datadoghq.com",};apiInstance.disableUser(params).then((data: v1.UserDisableResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
"""
Disable a user 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)api_instance.disable_user(user_id=USER_DATA_ID,)
# Disable 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"]api_instance.disable_user(USER_DATA_ID)
// Disable a user returns "OK" response
packagemainimport("context""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)r,err:=api.DisableUser(ctx,UserDataID)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `UsersApi.DisableUser`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}}
// Disable a user returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.UsersApi;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{apiInstance.disableUser(USER_DATA_ID);}catch(ApiExceptione){System.err.println("Exception when calling UsersApi#disableUser");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Disable a user 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.disable_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
/**
* Disable 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.UsersApiDisableUserRequest={userId: USER_DATA_ID,};apiInstance.disableUser(params).then((data: any)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
"""
Get a user organization returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.users_apiimportUsersApiconfiguration=Configuration()withApiClient(configuration)asapi_client:api_instance=UsersApi(api_client)response=api_instance.list_user_organizations(user_id="00000000-0000-9999-0000-000000000000",)print(response)
# Get a user organization returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::UsersAPI.newpapi_instance.list_user_organizations("00000000-0000-9999-0000-000000000000")
// Get a user organization 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(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewUsersApi(apiClient)resp,r,err:=api.ListUserOrganizations(ctx,"00000000-0000-9999-0000-000000000000")iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `UsersApi.ListUserOrganizations`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `UsersApi.ListUserOrganizations`:\n%s\n",responseContent)}
// Get a user organization 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);try{UserResponseresult=apiInstance.listUserOrganizations("00000000-0000-9999-0000-000000000000");System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling UsersApi#listUserOrganizations");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Get a user organization returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_users::UsersAPI;#[tokio::main]asyncfnmain(){letconfiguration=datadog::Configuration::new();letapi=UsersAPI::with_config(configuration);letresp=api.list_user_organizations("00000000-0000-9999-0000-000000000000".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="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Get a user organization returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.UsersApi(configuration);constparams: v2.UsersApiListUserOrganizationsRequest={userId:"00000000-0000-9999-0000-000000000000",};apiInstance.listUserOrganizations(params).then((data: v2.UserResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
Get a user permission set. Returns a list of the user’s permissions
granted by the associated user’s roles.
This endpoint requires the user_access_read permission.
OAuth apps require the user_access_read authorization scope to access this endpoint.
"""
Get a user permissions 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.list_user_permissions(user_id=USER_DATA_ID,)print(response)
# Get a user permissions 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.list_user_permissions(USER_DATA_ID)
// Get a user permissions 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.ListUserPermissions(ctx,UserDataID)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `UsersApi.ListUserPermissions`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `UsersApi.ListUserPermissions`:\n%s\n",responseContent)}
// Get a user permissions 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.PermissionsResponse;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{PermissionsResponseresult=apiInstance.listUserPermissions(USER_DATA_ID);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling UsersApi#listUserPermissions");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Get a user permissions 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.list_user_permissions(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 a user permissions 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.UsersApiListUserPermissionsRequest={userId: USER_DATA_ID,};apiInstance.listUserPermissions(params).then((data: v2.PermissionsResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
// Send invitation emails 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.UserInvitationsRequest{Data:[]datadogV2.UserInvitationData{{Type:datadogV2.USERINVITATIONSTYPE_USER_INVITATIONS,Relationships:datadogV2.UserInvitationRelationships{User:datadogV2.RelationshipToUser{Data:datadogV2.RelationshipToUserData{Type:datadogV2.USERSTYPE_USERS,Id:UserDataID,},},},},},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewUsersApi(apiClient)resp,r,err:=api.SendInvitations(ctx,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `UsersApi.SendInvitations`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `UsersApi.SendInvitations`:\n%s\n",responseContent)}
// Send invitation emails 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.RelationshipToUser;importcom.datadog.api.client.v2.model.RelationshipToUserData;importcom.datadog.api.client.v2.model.UserInvitationData;importcom.datadog.api.client.v2.model.UserInvitationRelationships;importcom.datadog.api.client.v2.model.UserInvitationsRequest;importcom.datadog.api.client.v2.model.UserInvitationsResponse;importcom.datadog.api.client.v2.model.UserInvitationsType;importcom.datadog.api.client.v2.model.UsersType;importjava.util.Collections;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");UserInvitationsRequestbody=newUserInvitationsRequest().data(Collections.singletonList(newUserInvitationData().type(UserInvitationsType.USER_INVITATIONS).relationships(newUserInvitationRelationships().user(newRelationshipToUser().data(newRelationshipToUserData().type(UsersType.USERS).id(USER_DATA_ID))))));try{UserInvitationsResponseresult=apiInstance.sendInvitations(body);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling UsersApi#sendInvitations");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
"""
Send invitation emails returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.users_apiimportUsersApifromdatadog_api_client.v2.model.relationship_to_userimportRelationshipToUserfromdatadog_api_client.v2.model.relationship_to_user_dataimportRelationshipToUserDatafromdatadog_api_client.v2.model.user_invitation_dataimportUserInvitationDatafromdatadog_api_client.v2.model.user_invitation_relationshipsimportUserInvitationRelationshipsfromdatadog_api_client.v2.model.user_invitations_requestimportUserInvitationsRequestfromdatadog_api_client.v2.model.user_invitations_typeimportUserInvitationsTypefromdatadog_api_client.v2.model.users_typeimportUsersType# there is a valid "user" in the systemUSER_DATA_ID=environ["USER_DATA_ID"]body=UserInvitationsRequest(data=[UserInvitationData(type=UserInvitationsType.USER_INVITATIONS,relationships=UserInvitationRelationships(user=RelationshipToUser(data=RelationshipToUserData(type=UsersType.USERS,id=USER_DATA_ID,),),),),],)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=UsersApi(api_client)response=api_instance.send_invitations(body=body)print(response)
# Send invitation emails 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::UserInvitationsRequest.new({data:[DatadogAPIClient::V2::UserInvitationData.new({type:DatadogAPIClient::V2::UserInvitationsType::USER_INVITATIONS,relationships:DatadogAPIClient::V2::UserInvitationRelationships.new({user:DatadogAPIClient::V2::RelationshipToUser.new({data:DatadogAPIClient::V2::RelationshipToUserData.new({type:DatadogAPIClient::V2::UsersType::USERS,id:USER_DATA_ID,}),}),}),}),],})papi_instance.send_invitations(body)
// Send invitation emails returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_users::UsersAPI;usedatadog_api_client::datadogV2::model::RelationshipToUser;usedatadog_api_client::datadogV2::model::RelationshipToUserData;usedatadog_api_client::datadogV2::model::UserInvitationData;usedatadog_api_client::datadogV2::model::UserInvitationRelationships;usedatadog_api_client::datadogV2::model::UserInvitationsRequest;usedatadog_api_client::datadogV2::model::UserInvitationsType;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=UserInvitationsRequest::new(vec![UserInvitationData::new(UserInvitationRelationships::new(RelationshipToUser::new(RelationshipToUserData::new(user_data_id.clone(),UsersType::USERS,))),UserInvitationsType::USER_INVITATIONS,)]);letconfiguration=datadog::Configuration::new();letapi=UsersAPI::with_config(configuration);letresp=api.send_invitations(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
/**
* Send invitation emails 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.UsersApiSendInvitationsRequest={body:{data:[{type:"user_invitations",relationships:{user:{data:{type:"users",id: USER_DATA_ID,},},},},],},};apiInstance.sendInvitations(params).then((data: v2.UserInvitationsResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
"""
Get a user invitation returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.users_apiimportUsersApi# the "user" has a "user_invitation"USER_INVITATION_ID=environ["USER_INVITATION_ID"]configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=UsersApi(api_client)response=api_instance.get_invitation(user_invitation_uuid=USER_INVITATION_ID,)print(response)
# Get a user invitation returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::UsersAPI.new# the "user" has a "user_invitation"USER_INVITATION_ID=ENV["USER_INVITATION_ID"]papi_instance.get_invitation(USER_INVITATION_ID)
// Get a user invitation 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(){// the "user" has a "user_invitation"
UserInvitationID:=os.Getenv("USER_INVITATION_ID")ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewUsersApi(apiClient)resp,r,err:=api.GetInvitation(ctx,UserInvitationID)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `UsersApi.GetInvitation`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `UsersApi.GetInvitation`:\n%s\n",responseContent)}
// Get a user invitation 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.UserInvitationResponse;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();UsersApiapiInstance=newUsersApi(defaultClient);// the "user" has a "user_invitation"StringUSER_INVITATION_ID=System.getenv("USER_INVITATION_ID");try{UserInvitationResponseresult=apiInstance.getInvitation(USER_INVITATION_ID);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling UsersApi#getInvitation");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Get a user invitation returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_users::UsersAPI;#[tokio::main]asyncfnmain(){// the "user" has a "user_invitation"
letuser_invitation_id=std::env::var("USER_INVITATION_ID").unwrap();letconfiguration=datadog::Configuration::new();letapi=UsersAPI::with_config(configuration);letresp=api.get_invitation(user_invitation_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 a user invitation returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.UsersApi(configuration);// the "user" has a "user_invitation"
constUSER_INVITATION_ID=process.env.USER_INVITATION_IDasstring;constparams: v2.UsersApiGetInvitationRequest={userInvitationUuid: USER_INVITATION_ID,};apiInstance.getInvitation(params).then((data: v2.UserInvitationResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));