Create a teams ownership mapping
https://api.datadoghq.com/api/v2/rum/config/teams-ownership/mappingshttps://api.us3.datadoghq.com/api/v2/rum/config/teams-ownership/mappingshttps://api.us5.datadoghq.com/api/v2/rum/config/teams-ownership/mappingshttps://api.datadoghq.eu/api/v2/rum/config/teams-ownership/mappingshttps://api.ap1.datadoghq.com/api/v2/rum/config/teams-ownership/mappingshttps://api.ap2.datadoghq.com/api/v2/rum/config/teams-ownership/mappingshttps://api.uk1.datadoghq.com/api/v2/rum/config/teams-ownership/mappingshttps://api.ddog-gov.com/api/v2/rum/config/teams-ownership/mappingshttps://api.us2.ddog-gov.com/api/v2/rum/config/teams-ownership/mappingsPrésentation
Create a teams ownership mapping for your organization. Returns the teams ownership mapping object from the request body when the request is successful.
Requête
Body Data (required)
The definition of the teams ownership mapping to create.
data [required]The JSON:API data envelope for a teams ownership mapping create request.
attributes [required]The attributes of the teams ownership mapping to create.
application_idThe ID of the RUM application this mapping applies to.
For browser applications, provide the real application UUID — the team is applied to the view regardless of service.
For mobile applications, omit this field (or set it to the nil UUID 00000000-0000-0000-0000-000000000000) — the team is applied to the view and service combination across all applications.
match_typeHow the view_name is matched against RUM view names.
exactexact, prefixserviceThe RUM application's service name. For browser applications, this is optional. For mobile applications, this is required and scopes the ownership to a specific service.
team_handle [required]The handle of the team that owns the matched RUM views.
view_name [required]The RUM view name to match, or its prefix when match_type is prefix.
type [required]The type of the resource. The value should always be teams_ownership_mappings.
teams_ownership_mappingsteams_ownership_mappings{
"data": {
"attributes": {
"application_id": "11111111-2222-3333-4444-555555555555",
"match_type": "exact",
"service": "web-checkout",
"team_handle": "team-rum",
"view_name": "/checkout"
},
"type": "teams_ownership_mappings"
}
}Réponse
Created
The response body for a single teams ownership mapping.
data [required]The JSON:API data envelope for a teams ownership mapping.
attributes [required]The attributes of a teams ownership mapping.
application_id [required]The ID of the RUM application this mapping applies to.
For browser applications, this is the real application UUID.
For mobile applications, this is the nil UUID 00000000-0000-0000-0000-000000000000 (wildcard), meaning the ownership applies across all applications.
created_at [required]Timestamp when the mapping was created.
created_by [required]The UUID of the user who created the mapping.
match_type [required]How the view_name is matched against RUM view names.
exactexact, prefixorg_id [required]The ID of the organization that owns this mapping.
service [required]The RUM application's service name. For browser applications, may be empty. For mobile applications, this is the service that scopes the ownership.
team_handle [required]The handle of the team that owns the matched RUM views.
view_name [required]The RUM view name to match, or its prefix when match_type is prefix.
id [required]The unique identifier of the teams ownership mapping.
type [required]The type of the resource. The value should always be teams_ownership_mappings.
teams_ownership_mappingsteams_ownership_mappings{
"data": {
"attributes": {
"application_id": "11111111-2222-3333-4444-555555555555",
"created_at": "2026-01-15T09:30:00.000Z",
"created_by": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
"match_type": "exact",
"org_id": 123456,
"service": "web-checkout",
"team_handle": "team-rum",
"view_name": "/checkout"
},
"id": "123",
"type": "teams_ownership_mappings"
}
}Bad Request
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}Not Authorized
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}Too many requests
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}Exemple de code
# 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 POST "https://api.${DD_SITE}/api/v2/rum/config/teams-ownership/mappings" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"application_id": "11111111-2222-3333-4444-555555555555",
"match_type": "exact",
"service": "web-checkout",
"team_handle": "team-rum",
"view_name": "/checkout"
},
"type": "teams_ownership_mappings"
}
}
EOF# 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 POST "https://api.${DD_SITE}/api/v2/rum/config/teams-ownership/mappings" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"application_id": "11111111-2222-3333-4444-555555555555",
"match_type": "exact",
"service": "web-checkout",
"team_handle": "team-rum",
"view_name": "/checkout"
},
"type": "teams_ownership_mappings"
}
}
EOF# 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 POST "https://api.${DD_SITE}/api/v2/rum/config/teams-ownership/mappings" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"application_id": "11111111-2222-3333-4444-555555555555",
"match_type": "exact",
"service": "web-checkout",
"team_handle": "team-rum",
"view_name": "/checkout"
},
"type": "teams_ownership_mappings"
}
}
EOF# 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 POST "https://api.${DD_SITE}/api/v2/rum/config/teams-ownership/mappings" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"application_id": "11111111-2222-3333-4444-555555555555",
"match_type": "exact",
"service": "web-checkout",
"team_handle": "team-rum",
"view_name": "/checkout"
},
"type": "teams_ownership_mappings"
}
}
EOF# 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 POST "https://api.${DD_SITE}/api/v2/rum/config/teams-ownership/mappings" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"application_id": "11111111-2222-3333-4444-555555555555",
"match_type": "exact",
"service": "web-checkout",
"team_handle": "team-rum",
"view_name": "/checkout"
},
"type": "teams_ownership_mappings"
}
}
EOF# 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 POST "https://api.${DD_SITE}/api/v2/rum/config/teams-ownership/mappings" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"application_id": "11111111-2222-3333-4444-555555555555",
"match_type": "exact",
"service": "web-checkout",
"team_handle": "team-rum",
"view_name": "/checkout"
},
"type": "teams_ownership_mappings"
}
}
EOF# 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 POST "https://api.${DD_SITE}/api/v2/rum/config/teams-ownership/mappings" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"application_id": "11111111-2222-3333-4444-555555555555",
"match_type": "exact",
"service": "web-checkout",
"team_handle": "team-rum",
"view_name": "/checkout"
},
"type": "teams_ownership_mappings"
}
}
EOF# 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 POST "https://api.${DD_SITE}/api/v2/rum/config/teams-ownership/mappings" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"application_id": "11111111-2222-3333-4444-555555555555",
"match_type": "exact",
"service": "web-checkout",
"team_handle": "team-rum",
"view_name": "/checkout"
},
"type": "teams_ownership_mappings"
}
}
EOF# 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 POST "https://api.${DD_SITE}/api/v2/rum/config/teams-ownership/mappings" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"application_id": "11111111-2222-3333-4444-555555555555",
"match_type": "exact",
"service": "web-checkout",
"team_handle": "team-rum",
"view_name": "/checkout"
},
"type": "teams_ownership_mappings"
}
}
EOF// Create a teams ownership mapping returns "Created" response
package main
import (
"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"
"github.com/google/uuid"
)
func main() {
body := datadogV2.TeamsOwnershipMappingCreateRequest{
Data: datadogV2.TeamsOwnershipMappingCreateData{
Attributes: datadogV2.TeamsOwnershipMappingCreateDataAttributes{
ApplicationId: datadog.PtrUUID(uuid.MustParse("11111111-2222-3333-4444-555555555555")),
MatchType: datadogV2.TEAMSOWNERSHIPMATCHTYPE_EXACT.Ptr(),
Service: datadog.PtrString("web-checkout"),
TeamHandle: "team-rum",
ViewName: "/checkout",
},
Type: datadogV2.TEAMSOWNERSHIPMAPPINGTYPE_TEAMS_OWNERSHIP_MAPPINGS,
},
}
ctx := datadog.NewDefaultContext(context.Background())
ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
configuration := datadog.NewConfiguration()
configuration.SetUnstableOperationEnabled("v2.CreateTeamsOwnershipMapping", true)
apiClient := datadog.NewAPIClient(configuration)
api := datadogV2.NewRumTeamsOwnershipApi(apiClient)
resp, r, err := api.CreateTeamsOwnershipMapping(ctx, body)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `RumTeamsOwnershipApi.CreateTeamsOwnershipMapping`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `RumTeamsOwnershipApi.CreateTeamsOwnershipMapping`:\n%s\n", responseContent)
}
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"// Create a teams ownership mapping returns "Created" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.RumTeamsOwnershipApi;
import com.datadog.api.client.v2.model.TeamsOwnershipMappingCreateData;
import com.datadog.api.client.v2.model.TeamsOwnershipMappingCreateDataAttributes;
import com.datadog.api.client.v2.model.TeamsOwnershipMappingCreateRequest;
import com.datadog.api.client.v2.model.TeamsOwnershipMappingResponse;
import com.datadog.api.client.v2.model.TeamsOwnershipMappingType;
import com.datadog.api.client.v2.model.TeamsOwnershipMatchType;
import java.util.UUID;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
defaultClient.setUnstableOperationEnabled("v2.createTeamsOwnershipMapping", true);
RumTeamsOwnershipApi apiInstance = new RumTeamsOwnershipApi(defaultClient);
TeamsOwnershipMappingCreateRequest body =
new TeamsOwnershipMappingCreateRequest()
.data(
new TeamsOwnershipMappingCreateData()
.attributes(
new TeamsOwnershipMappingCreateDataAttributes()
.applicationId(UUID.fromString("11111111-2222-3333-4444-555555555555"))
.matchType(TeamsOwnershipMatchType.EXACT)
.service("web-checkout")
.teamHandle("team-rum")
.viewName("/checkout"))
.type(TeamsOwnershipMappingType.TEAMS_OWNERSHIP_MAPPINGS));
try {
TeamsOwnershipMappingResponse result = apiInstance.createTeamsOwnershipMapping(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling RumTeamsOwnershipApi#createTeamsOwnershipMapping");
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""""
Create a teams ownership mapping returns "Created" response
"""
from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.rum_teams_ownership_api import RumTeamsOwnershipApi
from datadog_api_client.v2.model.teams_ownership_mapping_create_data import TeamsOwnershipMappingCreateData
from datadog_api_client.v2.model.teams_ownership_mapping_create_data_attributes import (
TeamsOwnershipMappingCreateDataAttributes,
)
from datadog_api_client.v2.model.teams_ownership_mapping_create_request import TeamsOwnershipMappingCreateRequest
from datadog_api_client.v2.model.teams_ownership_mapping_type import TeamsOwnershipMappingType
from datadog_api_client.v2.model.teams_ownership_match_type import TeamsOwnershipMatchType
from uuid import UUID
body = TeamsOwnershipMappingCreateRequest(
data=TeamsOwnershipMappingCreateData(
attributes=TeamsOwnershipMappingCreateDataAttributes(
application_id=UUID("11111111-2222-3333-4444-555555555555"),
match_type=TeamsOwnershipMatchType.EXACT,
service="web-checkout",
team_handle="team-rum",
view_name="/checkout",
),
type=TeamsOwnershipMappingType.TEAMS_OWNERSHIP_MAPPINGS,
),
)
configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
configuration.unstable_operations["create_teams_ownership_mapping"] = True
with ApiClient(configuration) as api_client:
api_instance = RumTeamsOwnershipApi(api_client)
response = api_instance.create_teams_ownership_mapping(body=body)
print(response)
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"# Create a teams ownership mapping returns "Created" response
require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
config.unstable_operations["v2.create_teams_ownership_mapping".to_sym] = true
end
api_instance = DatadogAPIClient::V2::RumTeamsOwnershipAPI.new
body = DatadogAPIClient::V2::TeamsOwnershipMappingCreateRequest.new({
data: DatadogAPIClient::V2::TeamsOwnershipMappingCreateData.new({
attributes: DatadogAPIClient::V2::TeamsOwnershipMappingCreateDataAttributes.new({
application_id: "11111111-2222-3333-4444-555555555555",
match_type: DatadogAPIClient::V2::TeamsOwnershipMatchType::EXACT,
service: "web-checkout",
team_handle: "team-rum",
view_name: "/checkout",
}),
type: DatadogAPIClient::V2::TeamsOwnershipMappingType::TEAMS_OWNERSHIP_MAPPINGS,
}),
})
p api_instance.create_teams_ownership_mapping(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"// Create a teams ownership mapping returns "Created" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_rum_teams_ownership::RumTeamsOwnershipAPI;
use datadog_api_client::datadogV2::model::TeamsOwnershipMappingCreateData;
use datadog_api_client::datadogV2::model::TeamsOwnershipMappingCreateDataAttributes;
use datadog_api_client::datadogV2::model::TeamsOwnershipMappingCreateRequest;
use datadog_api_client::datadogV2::model::TeamsOwnershipMappingType;
use datadog_api_client::datadogV2::model::TeamsOwnershipMatchType;
use uuid::Uuid;
#[tokio::main]
async fn main() {
let body = TeamsOwnershipMappingCreateRequest::new(TeamsOwnershipMappingCreateData::new(
TeamsOwnershipMappingCreateDataAttributes::new(
"team-rum".to_string(),
"/checkout".to_string(),
)
.application_id(
Uuid::parse_str("11111111-2222-3333-4444-555555555555").expect("invalid UUID"),
)
.match_type(TeamsOwnershipMatchType::EXACT)
.service("web-checkout".to_string()),
TeamsOwnershipMappingType::TEAMS_OWNERSHIP_MAPPINGS,
));
let mut configuration = datadog::Configuration::new();
configuration.set_unstable_operation_enabled("v2.create_teams_ownership_mapping", true);
let api = RumTeamsOwnershipAPI::with_config(configuration);
let resp = api.create_teams_ownership_mapping(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="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="us3.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="us5.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="datadoghq.eu" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="ap1.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="ap2.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="uk1.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="us2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run/**
* Create a teams ownership mapping returns "Created" 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.createTeamsOwnershipMapping"] = true;
const apiInstance = new v2.RumTeamsOwnershipApi(configuration);
const params: v2.RumTeamsOwnershipApiCreateTeamsOwnershipMappingRequest = {
body: {
data: {
attributes: {
applicationId: "11111111-2222-3333-4444-555555555555",
matchType: "exact",
service: "web-checkout",
teamHandle: "team-rum",
viewName: "/checkout",
},
type: "teams_ownership_mappings",
},
},
};
apiInstance
.createTeamsOwnershipMapping(params)
.then((data: v2.TeamsOwnershipMappingResponse) => {
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"