Update connection

Note: This endpoint may be subject to changes.

PUT https://api.ap1.datadoghq.com/api/v2/product-analytics/{entity}/mapping/connectionhttps://api.ap2.datadoghq.com/api/v2/product-analytics/{entity}/mapping/connectionhttps://api.datadoghq.eu/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/connectionhttps://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/connection

Overview

Update an existing data connection by adding, updating, or deleting fields

Arguments

Path Parameters

Name

Type

Description

entity [required]

string

The entity for which to update the connection

Request

Body Data (required)

Expand All

Field

Type

Description

data

object

The data object containing the resource identifier and attributes for updating an existing connection.

attributes

object

Attributes specifying the field modifications to apply to an existing connection.

fields_to_add

[object]

New fields to add to the connection from the data source.

description

string

Human-readable explanation of what the field represents.

display_name

string

The human-readable label for the field shown in the UI.

groups

[string]

List of group labels used to categorize the field.

id [required]

string

The unique identifier for the field within the connection.

source_name [required]

string

The name of the column or attribute in the source data system that maps to this field.

type [required]

string

The data type of the field (for example, string or number).

fields_to_delete

[string]

Identifiers of existing fields to remove from the connection.

fields_to_update

[object]

Existing fields with updated metadata to apply to the connection.

field_id [required]

string

The identifier of the existing field to update.

updated_description

string

The new description to set for the field.

updated_display_name

string

The new human-readable display name to set for the field.

updated_field_id

string

The new identifier to assign to the field, if renaming it.

updated_groups

[string]

The updated list of group labels to associate with the field.

id [required]

string

The unique identifier of the connection to update.

type [required]

enum

Connection id resource type. Allowed enum values: connection_id

default: connection_id

{
  "data": {
    "attributes": {
      "fields_to_add": [
        {
          "description": "string",
          "display_name": "string",
          "groups": [],
          "id": "",
          "source_name": "",
          "type": ""
        }
      ],
      "fields_to_delete": [],
      "fields_to_update": [
        {
          "field_id": "",
          "updated_description": "string",
          "updated_display_name": "string",
          "updated_field_id": "string",
          "updated_groups": []
        }
      ]
    },
    "id": "",
    "type": "connection_id"
  }
}

Response

Connection updated successfully

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  ## default
# 

# Path parameters
export entity="users"
# Curl command
curl -X PUT "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/product-analytics/${entity}/mapping/connection" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -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
"""

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.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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Update connection returns "Connection updated successfully" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// 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())
	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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" 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.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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
// 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.UpdateConnection", 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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.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();
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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"