Update connection
https://api.datadoghq.com/api/v2/product-analytics/{entity}/mapping/connectionhttps://api.us3.datadoghq.com/api/v2/product-analytics/{entity}/mapping/connectionhttps://api.us5.datadoghq.com/api/v2/product-analytics/{entity}/mapping/connectionhttps://api.datadoghq.eu/api/v2/product-analytics/{entity}/mapping/connectionhttps://api.ap1.datadoghq.com/api/v2/product-analytics/{entity}/mapping/connectionhttps://api.ap2.datadoghq.com/api/v2/product-analytics/{entity}/mapping/connectionhttps://api.uk1.datadoghq.com/api/v2/product-analytics/{entity}/mapping/connectionhttps://api.ddog-gov.com/api/v2/product-analytics/{entity}/mapping/connectionhttps://api.us2.ddog-gov.com/api/v2/product-analytics/{entity}/mapping/connection概要
Update an existing data connection by adding, updating, or deleting fields
引数
パスパラメーター
entity [required]The entity for which to update the connection
リクエスト
Body Data (required)
dataThe data object containing the resource identifier and attributes for updating an existing connection.
attributesAttributes specifying the field modifications to apply to an existing connection.
fields_to_addNew fields to add to the connection from the data source.
descriptionHuman-readable explanation of what the field represents.
display_nameThe human-readable label for the field shown in the UI.
groupsList of group labels used to categorize the field.
id [required]The unique identifier for the field within the connection.
source_name [required]The name of the column or attribute in the source data system that maps to this field.
type [required]The data type of the field (for example, string or number).
fields_to_deleteIdentifiers of existing fields to remove from the connection.
fields_to_updateExisting fields with updated metadata to apply to the connection.
field_id [required]The identifier of the existing field to update.
updated_descriptionThe new description to set for the field.
updated_display_nameThe new human-readable display name to set for the field.
updated_field_idThe new identifier to assign to the field, if renaming it.
updated_groupsThe updated list of group labels to associate with the field.
id [required]The unique identifier of the connection to update.
type [required]Connection id resource type.
connection_idconnection_id{
"data": {
"attributes": {
"fields_to_add": [
{
"description": "Net Promoter Score from customer surveys",
"display_name": "NPS Score",
"groups": [
"Satisfaction",
"Metrics"
],
"id": "nps_score",
"source_name": "net_promoter_score",
"type": "number"
}
],
"fields_to_delete": [
"old_revenue_field"
],
"fields_to_update": [
{
"field_id": "lifetime_value",
"updated_display_name": "Customer Lifetime Value (`USD`)",
"updated_groups": [
"Financial",
"Metrics"
]
}
]
},
"id": "crm-integration",
"type": "connection_id"
}
}応答
Connection updated successfully
Too many requests
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}コード例
# Path parameters
export entity="users"
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PUT "https://api.${DD_SITE}/api/v2/product-analytics/${entity}/mapping/connection" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"fields_to_add": [
{
"description": "Net Promoter Score from customer surveys",
"display_name": "NPS Score",
"groups": [
"Satisfaction",
"Metrics"
],
"id": "nps_score",
"source_name": "net_promoter_score",
"type": "number"
}
],
"fields_to_delete": [
"old_revenue_field"
],
"fields_to_update": [
{
"field_id": "lifetime_value",
"updated_display_name": "Customer Lifetime Value (`USD`)",
"updated_groups": [
"Financial",
"Metrics"
]
}
]
},
"id": "crm-integration",
"type": "connection_id"
}
}
EOF# Path parameters
export entity="users"
# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PUT "https://api.${DD_SITE}/api/v2/product-analytics/${entity}/mapping/connection" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"fields_to_add": [
{
"description": "Net Promoter Score from customer surveys",
"display_name": "NPS Score",
"groups": [
"Satisfaction",
"Metrics"
],
"id": "nps_score",
"source_name": "net_promoter_score",
"type": "number"
}
],
"fields_to_delete": [
"old_revenue_field"
],
"fields_to_update": [
{
"field_id": "lifetime_value",
"updated_display_name": "Customer Lifetime Value (`USD`)",
"updated_groups": [
"Financial",
"Metrics"
]
}
]
},
"id": "crm-integration",
"type": "connection_id"
}
}
EOF# Path parameters
export entity="users"
# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PUT "https://api.${DD_SITE}/api/v2/product-analytics/${entity}/mapping/connection" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"fields_to_add": [
{
"description": "Net Promoter Score from customer surveys",
"display_name": "NPS Score",
"groups": [
"Satisfaction",
"Metrics"
],
"id": "nps_score",
"source_name": "net_promoter_score",
"type": "number"
}
],
"fields_to_delete": [
"old_revenue_field"
],
"fields_to_update": [
{
"field_id": "lifetime_value",
"updated_display_name": "Customer Lifetime Value (`USD`)",
"updated_groups": [
"Financial",
"Metrics"
]
}
]
},
"id": "crm-integration",
"type": "connection_id"
}
}
EOF# Path parameters
export entity="users"
# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PUT "https://api.${DD_SITE}/api/v2/product-analytics/${entity}/mapping/connection" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"fields_to_add": [
{
"description": "Net Promoter Score from customer surveys",
"display_name": "NPS Score",
"groups": [
"Satisfaction",
"Metrics"
],
"id": "nps_score",
"source_name": "net_promoter_score",
"type": "number"
}
],
"fields_to_delete": [
"old_revenue_field"
],
"fields_to_update": [
{
"field_id": "lifetime_value",
"updated_display_name": "Customer Lifetime Value (`USD`)",
"updated_groups": [
"Financial",
"Metrics"
]
}
]
},
"id": "crm-integration",
"type": "connection_id"
}
}
EOF# Path parameters
export entity="users"
# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PUT "https://api.${DD_SITE}/api/v2/product-analytics/${entity}/mapping/connection" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"fields_to_add": [
{
"description": "Net Promoter Score from customer surveys",
"display_name": "NPS Score",
"groups": [
"Satisfaction",
"Metrics"
],
"id": "nps_score",
"source_name": "net_promoter_score",
"type": "number"
}
],
"fields_to_delete": [
"old_revenue_field"
],
"fields_to_update": [
{
"field_id": "lifetime_value",
"updated_display_name": "Customer Lifetime Value (`USD`)",
"updated_groups": [
"Financial",
"Metrics"
]
}
]
},
"id": "crm-integration",
"type": "connection_id"
}
}
EOF# Path parameters
export entity="users"
# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PUT "https://api.${DD_SITE}/api/v2/product-analytics/${entity}/mapping/connection" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"fields_to_add": [
{
"description": "Net Promoter Score from customer surveys",
"display_name": "NPS Score",
"groups": [
"Satisfaction",
"Metrics"
],
"id": "nps_score",
"source_name": "net_promoter_score",
"type": "number"
}
],
"fields_to_delete": [
"old_revenue_field"
],
"fields_to_update": [
{
"field_id": "lifetime_value",
"updated_display_name": "Customer Lifetime Value (`USD`)",
"updated_groups": [
"Financial",
"Metrics"
]
}
]
},
"id": "crm-integration",
"type": "connection_id"
}
}
EOF# Path parameters
export entity="users"
# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PUT "https://api.${DD_SITE}/api/v2/product-analytics/${entity}/mapping/connection" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"fields_to_add": [
{
"description": "Net Promoter Score from customer surveys",
"display_name": "NPS Score",
"groups": [
"Satisfaction",
"Metrics"
],
"id": "nps_score",
"source_name": "net_promoter_score",
"type": "number"
}
],
"fields_to_delete": [
"old_revenue_field"
],
"fields_to_update": [
{
"field_id": "lifetime_value",
"updated_display_name": "Customer Lifetime Value (`USD`)",
"updated_groups": [
"Financial",
"Metrics"
]
}
]
},
"id": "crm-integration",
"type": "connection_id"
}
}
EOF# Path parameters
export entity="users"
# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PUT "https://api.${DD_SITE}/api/v2/product-analytics/${entity}/mapping/connection" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"fields_to_add": [
{
"description": "Net Promoter Score from customer surveys",
"display_name": "NPS Score",
"groups": [
"Satisfaction",
"Metrics"
],
"id": "nps_score",
"source_name": "net_promoter_score",
"type": "number"
}
],
"fields_to_delete": [
"old_revenue_field"
],
"fields_to_update": [
{
"field_id": "lifetime_value",
"updated_display_name": "Customer Lifetime Value (`USD`)",
"updated_groups": [
"Financial",
"Metrics"
]
}
]
},
"id": "crm-integration",
"type": "connection_id"
}
}
EOF# Path parameters
export entity="users"
# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PUT "https://api.${DD_SITE}/api/v2/product-analytics/${entity}/mapping/connection" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"fields_to_add": [
{
"description": "Net Promoter Score from customer surveys",
"display_name": "NPS Score",
"groups": [
"Satisfaction",
"Metrics"
],
"id": "nps_score",
"source_name": "net_promoter_score",
"type": "number"
}
],
"fields_to_delete": [
"old_revenue_field"
],
"fields_to_update": [
{
"field_id": "lifetime_value",
"updated_display_name": "Customer Lifetime Value (`USD`)",
"updated_groups": [
"Financial",
"Metrics"
]
}
]
},
"id": "crm-integration",
"type": "connection_id"
}
}
EOF// Update connection returns "Connection updated successfully" response
package main
import (
"context"
"fmt"
"os"
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)
func main() {
body := datadogV2.UpdateConnectionRequest{
Data: &datadogV2.UpdateConnectionRequestData{
Attributes: &datadogV2.UpdateConnectionRequestDataAttributes{
FieldsToAdd: []datadogV2.CreateConnectionRequestDataAttributesFieldsItems{
{
Description: datadog.PtrString("Net Promoter Score from customer surveys"),
DisplayName: datadog.PtrString("NPS Score"),
Groups: []string{
"Satisfaction",
"Metrics",
},
Id: "nps_score",
SourceName: "net_promoter_score",
Type: "number",
},
},
FieldsToDelete: []string{
"old_revenue_field",
},
FieldsToUpdate: []datadogV2.UpdateConnectionRequestDataAttributesFieldsToUpdateItems{
{
FieldId: "lifetime_value",
UpdatedDisplayName: datadog.PtrString(`Customer Lifetime Value (` + "`" + `USD` + "`" + `)`),
UpdatedGroups: []string{
"Financial",
"Metrics",
},
},
},
},
Id: "crm-integration",
Type: datadogV2.UPDATECONNECTIONREQUESTDATATYPE_CONNECTION_ID,
},
}
ctx := datadog.NewDefaultContext(context.Background())
ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
configuration := datadog.NewConfiguration()
configuration.SetUnstableOperationEnabled("v2.UpdateConnection", true)
apiClient := datadog.NewAPIClient(configuration)
api := datadogV2.NewRumAudienceManagementApi(apiClient)
r, err := api.UpdateConnection(ctx, "users", body)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `RumAudienceManagementApi.UpdateConnection`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
Instructions
First install the library and its dependencies and then save the example to main.go and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"// Update connection returns "Connection updated successfully" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.RumAudienceManagementApi;
import com.datadog.api.client.v2.model.CreateConnectionRequestDataAttributesFieldsItems;
import com.datadog.api.client.v2.model.UpdateConnectionRequest;
import com.datadog.api.client.v2.model.UpdateConnectionRequestData;
import com.datadog.api.client.v2.model.UpdateConnectionRequestDataAttributes;
import com.datadog.api.client.v2.model.UpdateConnectionRequestDataAttributesFieldsToUpdateItems;
import com.datadog.api.client.v2.model.UpdateConnectionRequestDataType;
import java.util.Arrays;
import java.util.Collections;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
defaultClient.setUnstableOperationEnabled("v2.updateConnection", true);
RumAudienceManagementApi apiInstance = new RumAudienceManagementApi(defaultClient);
UpdateConnectionRequest body =
new UpdateConnectionRequest()
.data(
new UpdateConnectionRequestData()
.attributes(
new UpdateConnectionRequestDataAttributes()
.fieldsToAdd(
Collections.singletonList(
new CreateConnectionRequestDataAttributesFieldsItems()
.description("Net Promoter Score from customer surveys")
.displayName("NPS Score")
.groups(Arrays.asList("Satisfaction", "Metrics"))
.id("nps_score")
.sourceName("net_promoter_score")
.type("number")))
.fieldsToDelete(Collections.singletonList("old_revenue_field"))
.fieldsToUpdate(
Collections.singletonList(
new UpdateConnectionRequestDataAttributesFieldsToUpdateItems()
.fieldId("lifetime_value")
.updatedDisplayName("Customer Lifetime Value (`USD`)")
.updatedGroups(Arrays.asList("Financial", "Metrics")))))
.id("crm-integration")
.type(UpdateConnectionRequestDataType.CONNECTION_ID));
try {
apiInstance.updateConnection("users", body);
} catch (ApiException e) {
System.err.println("Exception when calling RumAudienceManagementApi#updateConnection");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Instructions
First install the library and its dependencies and then save the example to Example.java and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java""""
Update connection returns "Connection updated successfully" response
"""
from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.rum_audience_management_api import RumAudienceManagementApi
from datadog_api_client.v2.model.create_connection_request_data_attributes_fields_items import (
CreateConnectionRequestDataAttributesFieldsItems,
)
from datadog_api_client.v2.model.update_connection_request import UpdateConnectionRequest
from datadog_api_client.v2.model.update_connection_request_data import UpdateConnectionRequestData
from datadog_api_client.v2.model.update_connection_request_data_attributes import UpdateConnectionRequestDataAttributes
from datadog_api_client.v2.model.update_connection_request_data_attributes_fields_to_update_items import (
UpdateConnectionRequestDataAttributesFieldsToUpdateItems,
)
from datadog_api_client.v2.model.update_connection_request_data_type import UpdateConnectionRequestDataType
body = UpdateConnectionRequest(
data=UpdateConnectionRequestData(
attributes=UpdateConnectionRequestDataAttributes(
fields_to_add=[
CreateConnectionRequestDataAttributesFieldsItems(
description="Net Promoter Score from customer surveys",
display_name="NPS Score",
groups=[
"Satisfaction",
"Metrics",
],
id="nps_score",
source_name="net_promoter_score",
type="number",
),
],
fields_to_delete=[
"old_revenue_field",
],
fields_to_update=[
UpdateConnectionRequestDataAttributesFieldsToUpdateItems(
field_id="lifetime_value",
updated_display_name="Customer Lifetime Value (`USD`)",
updated_groups=[
"Financial",
"Metrics",
],
),
],
),
id="crm-integration",
type=UpdateConnectionRequestDataType.CONNECTION_ID,
),
)
configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
configuration.unstable_operations["update_connection"] = True
with ApiClient(configuration) as api_client:
api_instance = RumAudienceManagementApi(api_client)
api_instance.update_connection(entity="users", body=body)
Instructions
First install the library and its dependencies and then save the example to example.py and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"# Update connection returns "Connection updated successfully" response
require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
config.unstable_operations["v2.update_connection".to_sym] = true
end
api_instance = DatadogAPIClient::V2::RumAudienceManagementAPI.new
body = DatadogAPIClient::V2::UpdateConnectionRequest.new({
data: DatadogAPIClient::V2::UpdateConnectionRequestData.new({
attributes: DatadogAPIClient::V2::UpdateConnectionRequestDataAttributes.new({
fields_to_add: [
DatadogAPIClient::V2::CreateConnectionRequestDataAttributesFieldsItems.new({
description: "Net Promoter Score from customer surveys",
display_name: "NPS Score",
groups: [
"Satisfaction",
"Metrics",
],
id: "nps_score",
source_name: "net_promoter_score",
type: "number",
}),
],
fields_to_delete: [
"old_revenue_field",
],
fields_to_update: [
DatadogAPIClient::V2::UpdateConnectionRequestDataAttributesFieldsToUpdateItems.new({
field_id: "lifetime_value",
updated_display_name: "Customer Lifetime Value (`USD`)",
updated_groups: [
"Financial",
"Metrics",
],
}),
],
}),
id: "crm-integration",
type: DatadogAPIClient::V2::UpdateConnectionRequestDataType::CONNECTION_ID,
}),
})
p api_instance.update_connection("users", body)
Instructions
First install the library and its dependencies and then save the example to example.rb and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"// Update connection returns "Connection updated successfully" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_rum_audience_management::RumAudienceManagementAPI;
use datadog_api_client::datadogV2::model::CreateConnectionRequestDataAttributesFieldsItems;
use datadog_api_client::datadogV2::model::UpdateConnectionRequest;
use datadog_api_client::datadogV2::model::UpdateConnectionRequestData;
use datadog_api_client::datadogV2::model::UpdateConnectionRequestDataAttributes;
use datadog_api_client::datadogV2::model::UpdateConnectionRequestDataAttributesFieldsToUpdateItems;
use datadog_api_client::datadogV2::model::UpdateConnectionRequestDataType;
#[tokio::main]
async fn main() {
let body = UpdateConnectionRequest::new().data(
UpdateConnectionRequestData::new(
"crm-integration".to_string(),
UpdateConnectionRequestDataType::CONNECTION_ID,
)
.attributes(
UpdateConnectionRequestDataAttributes::new()
.fields_to_add(vec![CreateConnectionRequestDataAttributesFieldsItems::new(
"nps_score".to_string(),
"net_promoter_score".to_string(),
"number".to_string(),
)
.description("Net Promoter Score from customer surveys".to_string())
.display_name("NPS Score".to_string())
.groups(vec!["Satisfaction".to_string(), "Metrics".to_string()])])
.fields_to_delete(vec!["old_revenue_field".to_string()])
.fields_to_update(vec![
UpdateConnectionRequestDataAttributesFieldsToUpdateItems::new(
"lifetime_value".to_string(),
)
.updated_display_name(r#"Customer Lifetime Value (`USD`)"#.to_string())
.updated_groups(vec!["Financial".to_string(), "Metrics".to_string()]),
]),
),
);
let mut configuration = datadog::Configuration::new();
configuration.set_unstable_operation_enabled("v2.update_connection", true);
let api = RumAudienceManagementAPI::with_config(configuration);
let resp = api.update_connection("users".to_string(), body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
Instructions
First install the library and its dependencies and then save the example to src/main.rs and run following commands:
DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us3.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us5.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="datadoghq.eu" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ap1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ap2.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="uk1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run/**
* Update connection returns "Connection updated successfully" response
*/
import { client, v2 } from "@datadog/datadog-api-client";
const configuration = client.createConfiguration({
authMethods: {
AuthZ: {
accessToken: process.env.DD_BEARER_TOKEN as string,
},
},
});
configuration.unstableOperations["v2.updateConnection"] = true;
const apiInstance = new v2.RumAudienceManagementApi(configuration);
const params: v2.RumAudienceManagementApiUpdateConnectionRequest = {
body: {
data: {
attributes: {
fieldsToAdd: [
{
description: "Net Promoter Score from customer surveys",
displayName: "NPS Score",
groups: ["Satisfaction", "Metrics"],
id: "nps_score",
sourceName: "net_promoter_score",
type: "number",
},
],
fieldsToDelete: ["old_revenue_field"],
fieldsToUpdate: [
{
fieldId: "lifetime_value",
updatedDisplayName:
`Customer Lifetime Value (` + "`" + `USD` + "`" + `)`,
updatedGroups: ["Financial", "Metrics"],
},
],
},
id: "crm-integration",
type: "connection_id",
},
},
entity: "users",
};
apiInstance
.updateConnection(params)
.then((data: any) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
Instructions
First install the library and its dependencies and then save the example to example.ts and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"