Mettre à jour l'état d'un problème
https://api.datadoghq.com/api/v2/error-tracking/issues/{issue_id}/statehttps://api.us3.datadoghq.com/api/v2/error-tracking/issues/{issue_id}/statehttps://api.us5.datadoghq.com/api/v2/error-tracking/issues/{issue_id}/statehttps://api.datadoghq.eu/api/v2/error-tracking/issues/{issue_id}/statehttps://api.ap1.datadoghq.com/api/v2/error-tracking/issues/{issue_id}/statehttps://api.ap2.datadoghq.com/api/v2/error-tracking/issues/{issue_id}/statehttps://api.uk1.datadoghq.com/api/v2/error-tracking/issues/{issue_id}/statehttps://api.ddog-gov.com/api/v2/error-tracking/issues/{issue_id}/statehttps://api.us2.ddog-gov.com/api/v2/error-tracking/issues/{issue_id}/statePrésentation
Mettre à jour l'état d'un problème par issue_id. Utilisez cet endpoint pour faire passer un problème d'un état à un autre, par exemple OPEN, RESOLVED ou IGNORED.
OAuth apps require the error_tracking_read, error_tracking_write authorization scope to access this endpoint.
Arguments
Paramètres du chemin
issue_id [required]The identifier of the issue.
Requête
Body Data (required)
Charge utile de la requête de mise à jour de l'état d'un problème.
data [required]Charge utile de la requête de mise à jour de l'état d'un problème.
attributes [required]Object describing an issue state update request.
state [required]State of the issue
OPEN, ACKNOWLEDGED, RESOLVED, IGNORED, EXCLUDEDid [required]Issue identifier.
type [required]Type of the object.
error_tracking_issue{
"data": {
"attributes": {
"state": "RESOLVED"
},
"id": "c1726a66-1f64-11ee-b338-da7ad0900002",
"type": "error_tracking_issue"
}
}Réponse
OK
Response containing error tracking issue data.
dataThe issue matching the request.
attributes [required]Object containing the information of an issue.
error_messageError message associated with the issue.
error_typeType of the error that matches the issue.
file_pathPath of the file where the issue occurred.
first_seenTimestamp of the first seen error in milliseconds since the Unix epoch.
first_seen_versionThe application version (for example, git commit hash) where the issue was first observed.
function_nameName of the function where the issue occurred.
is_crashError is a crash.
languagesArray of programming languages associated with the issue.
last_seenTimestamp of the last seen error in milliseconds since the Unix epoch.
last_seen_versionThe application version (for example, git commit hash) where the issue was last observed.
platformPlatform associated with the issue.
ANDROID, BACKEND, BROWSER, FLUTTER, IOS, REACT_NATIVE, ROKU, UNKNOWNregressionRegression information for an issue that was previously resolved and then reopened.
regressed_at [required]Timestamp when the issue was reopened (regressed).
regressed_at_versionApplication version where the regression was observed.
resolved_at [required]Timestamp when the issue was resolved before the regression.
serviceService name.
stateState of the issue
OPEN, ACKNOWLEDGED, RESOLVED, IGNORED, EXCLUDEDid [required]Issue identifier.
relationshipsRelationship between the issue and an assignee, case and/or teams.
assigneeRelationship between the issue and assignee.
data [required]The user the issue is assigned to.
id [required]User identifier.
type [required]Type of the object
usercaseRelationship between the issue and case.
data [required]The case the issue is attached to.
id [required]Case identifier.
type [required]Type of the object.
casesamplesRelationship between the issue and its curated error samples.
data [required]Array of curated error samples of the issue.
id [required]Sample identifier.
type [required]Type of the object.
error_tracking_issue_sampleteam_ownersRelationship between the issue and teams.
data [required]Array of teams that are owners of the issue.
id [required]Team identifier.
type [required]Type of the object.
teamtype [required]Type of the object.
issueincludedArray of resources related to the issue.
<type=case>The case attached to the issue.
attributes [required]Object containing the information of a case.
archived_atTimestamp of when the case was archived.
closed_atTimestamp of when the case was closed.
created_atTimestamp of when the case was created.
creation_sourceSource of the case creation.
descriptionDescription of the case.
due_dateDue date of the case.
insightsInsights of the case.
refReference of the insight.
resource_idInsight identifier.
typeType of the insight.
jira_issueJira issue of the case.
error_messageError message set when the Jira issue creation fails.
resultContains the identifiers and URL for a successfully created Jira issue.
account_idJira account identifier.
issue_idJira issue identifier.
issue_keyJira issue key.
issue_urlJira issue URL.
project_idJira project identifier.
project_keyJira project key.
statusCreation status of the Jira issue.
keyKey of the case.
linear_issueLinear issue of the case.
error_messageError message set when the Linear issue creation fails.
resultContains the identifiers and URL for a successfully created Linear issue.
account_idLinear account identifier.
issue_idLinear issue identifier.
issue_keyLinear issue key.
issue_urlLinear issue URL.
team_idLinear team identifier.
statusCreation status of the Linear issue.
modified_atTimestamp of when the case was last modified.
priorityWork item priority
NOT_DEFINEDNOT_DEFINED, P1, P2, P3, P4, P5status [deprecated]DEPRECATED
Deprecated way of representing the work item status, which only supports OPEN, IN_PROGRESS, and CLOSED statuses. Use status_name instead.
OPEN, IN_PROGRESS, CLOSEDtitleTitle of the case.
typeType of the case.
id [required]Case identifier.
relationshipsResources related to a case.
assigneeRelationship to user.
data [required]Relationship to user object.
id [required]A unique identifier that represents the user.
type [required]User resource type.
userusercreated_byRelationship to user.
data [required]Relationship to user object.
id [required]A unique identifier that represents the user.
type [required]User resource type.
userusermodified_byRelationship to user.
data [required]Relationship to user object.
id [required]A unique identifier that represents the user.
type [required]User resource type.
useruserprojectRelationship to project.
data [required]Relationship to project object.
id [required]A unique identifier that represents the project.
type [required]Project resource type.
projectprojecttype [required]Type of the object.
case<type=user>The user to whom the issue is assigned.
attributes [required]Object containing the information of a user.
emailEmail of the user.
handleHandle of the user.
nameName of the user.
id [required]User identifier.
type [required]Type of the object
user<type=team>A team that owns an issue.
attributes [required]Object containing the information of a team.
handleThe team's identifier.
nameThe name of the team.
summaryA brief summary of the team, derived from its description.
id [required]Team identifier.
type [required]Type of the object.
team<type=error_tracking_issue_sample>An error event of the issue, picked because it satisfies one or more sample biases.
attributes [required]Object containing the information of a sample.
application_idRUM application identifier of the error.
biasesBiases the sample satisfies. A single error can satisfy several biases.
build_idBuild identifier of the mobile application.
bundle_versionBundle version of the mobile application.
data_sourceProduct that reported the error. The value is NONE when the error has no known origin.
APM, LOGS, RUM, LLMOBS, SYNTHETICS, NONEdebug_idDebug identifier used to resolve the stack trace of the error to source code.
debug_info_capturedWhether an Exception Replay snapshot was captured for the error.
error_source_typeSource type set by the SDK or tracer that reported the error, such as browser for RUM browser errors
or Crashtracking for backend crash reports. Usually not set for APM and logs errors.
error_stack [required]Parsed stack trace of the error. Only the sample picked by the git_metadata bias has frames.
framesStack frames, from the top of the stack.
code_snippetSource code around a stack frame. Empty when the source code is unavailable.
linesLines of source code.
offsetLine number of the first line of the snippet, starting at 1.
git_file_locationLocation of a stack frame in a repository file. Empty when the source code is unavailable.
columnColumn of the location, starting at 1.
filepathPath of the file in the repository.
first_lineFirst line of the location, starting at 1.
last_lineLast line of the location, starting at 1.
refGit reference of the file, usually a commit SHA.
repo_idRepository identifier.
textText of the frame, as it appears in the stack trace.
languageProgramming language used to parse the stack trace.
eventRaw error event, as stored by its data source. Its fields differ between APM, logs, and RUM.
git_commit_shaGit commit SHA of the service version.
git_repository_idGit repository identifier of the service.
git_repository_urlGit repository URL of the service.
has_session_replayWhether a RUM session replay is available for the error.
languageProgramming language of the service.
linksSource code locations of the stack frames that resolve to a repository file.
code_location [required]Location of a stack frame in a repository file. Empty when the source code is unavailable.
columnColumn of the location, starting at 1.
filepathPath of the file in the repository.
first_lineFirst line of the location, starting at 1.
last_lineLast line of the location, starting at 1.
refGit reference of the file, usually a commit SHA.
repo_idRepository identifier.
frame_id [required]Index of the frame in the stack trace, starting at 0.
os_nameOperating system of the device that reported the error.
serviceService name.
session_idRUM session identifier of the error.
session_replay_urlURL of the RUM session replay of the error.
snapshot_idIdentifier of the Exception Replay snapshot of the error.
span_idAPM span identifier of the error.
timestamp [required]Timestamp of the error.
trace_idAPM trace identifier of the error.
variantBuild variant of the mobile application.
versionVersion of the service.
view_idRUM view identifier of the error.
id [required]Sample identifier.
type [required]Type of the object.
error_tracking_issue_sample{
"data": {
"attributes": {
"error_message": "object of type 'NoneType' has no len()",
"error_type": "builtins.TypeError",
"file_path": "/django-email/conduit/apps/core/utils.py",
"first_seen": 1671612804001,
"first_seen_version": "aaf65cd0",
"function_name": "filter_forbidden_tags",
"is_crash": false,
"languages": [
"PYTHON",
"GO"
],
"last_seen": 1671620003100,
"last_seen_version": "b6199f80",
"platform": "BACKEND",
"regression": {
"regressed_at": "2024-01-03T08:00:00Z",
"regressed_at_version": "v2.5.2",
"resolved_at": "2024-01-01T10:00:00Z"
},
"service": "email-api-py",
"state": "RESOLVED"
},
"id": "c1726a66-1f64-11ee-b338-da7ad0900002",
"relationships": {
"assignee": {
"data": {
"id": "87cb11a0-278c-440a-99fe-701223c80296",
"type": "user"
}
},
"case": {
"data": {
"id": "2841440d-e780-4fe2-96cd-6a8c1d194da5",
"type": "case"
}
},
"samples": {
"data": [
{
"id": "AwAAAZPHnBVMDCSmFgAAABhBWlBIbkJWTUFBRDVnUkhKTmY0WmhRQUEAAAAkMDE5M2M3OWMtMTg1OC00ZTE1LWFhMmItOTQ1N2ZkOGVlMzQyAAAAAA",
"type": "error_tracking_issue_sample"
}
]
},
"team_owners": {
"data": [
{
"id": "221b0179-6447-4d03-91c3-3ca98bf60e8a",
"type": "team"
}
]
}
},
"type": "issue"
},
"included": [
{
"attributes": {
"archived_at": "2025-01-01T00:00:00Z",
"closed_at": "2025-01-01T00:00:00Z",
"created_at": "2025-01-01T00:00:00Z",
"creation_source": "ERROR_TRACKING",
"description": "string",
"due_date": "2025-01-01",
"insights": [
{
"ref": "/error-tracking?issueId=2841440d-e780-4fe2-96cd-6a8c1d194da5",
"resource_id": "2841440d-e780-4fe2-96cd-6a8c1d194da5",
"type": "ERROR_TRACKING"
}
],
"jira_issue": {
"error_message": "",
"result": {
"account_id": "abcd1234-5678-90ab-cdef-1234567890ab",
"issue_id": "1904866",
"issue_key": "ET-123",
"issue_url": "https://your-jira-instance.atlassian.net/browse/ET-123",
"project_id": "10001",
"project_key": "ET"
},
"status": "COMPLETED"
},
"key": "ET-123",
"linear_issue": {
"error_message": "",
"result": {
"account_id": "abcd1234-5678-90ab-cdef-1234567890ab",
"issue_id": "a1b2c3d4-5678-90ab-cdef-1234567890ab",
"issue_key": "ENG-123",
"issue_url": "https://linear.app/your-workspace/issue/ENG-123",
"team_id": "f1e2d3c4-5678-90ab-cdef-1234567890ab"
},
"status": "COMPLETED"
},
"modified_at": "2025-01-01T00:00:00Z",
"priority": "NOT_DEFINED",
"status": "OPEN",
"title": "Error: HTTP error",
"type": "ERROR_TRACKING_ISSUE"
},
"id": "2841440d-e780-4fe2-96cd-6a8c1d194da5",
"relationships": {
"assignee": {
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "user"
}
},
"created_by": {
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "user"
}
},
"modified_by": {
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "user"
}
},
"project": {
"data": {
"id": "e555e290-ed65-49bd-ae18-8acbfcf18db7",
"type": "project"
}
}
},
"type": "case"
}
]
}Bad Request
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}Unauthorized
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}Forbidden
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}Not Found
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
# Path parameters
export issue_id="c1726a66-1f64-11ee-b338-da7ad0900002"
# 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/error-tracking/issues/${issue_id}/state" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"state": "RESOLVED"
},
"id": "c1726a66-1f64-11ee-b338-da7ad0900002",
"type": "error_tracking_issue"
}
}
EOF# Path parameters
export issue_id="c1726a66-1f64-11ee-b338-da7ad0900002"
# 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/error-tracking/issues/${issue_id}/state" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"state": "RESOLVED"
},
"id": "c1726a66-1f64-11ee-b338-da7ad0900002",
"type": "error_tracking_issue"
}
}
EOF# Path parameters
export issue_id="c1726a66-1f64-11ee-b338-da7ad0900002"
# 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/error-tracking/issues/${issue_id}/state" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"state": "RESOLVED"
},
"id": "c1726a66-1f64-11ee-b338-da7ad0900002",
"type": "error_tracking_issue"
}
}
EOF# Path parameters
export issue_id="c1726a66-1f64-11ee-b338-da7ad0900002"
# 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/error-tracking/issues/${issue_id}/state" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"state": "RESOLVED"
},
"id": "c1726a66-1f64-11ee-b338-da7ad0900002",
"type": "error_tracking_issue"
}
}
EOF# Path parameters
export issue_id="c1726a66-1f64-11ee-b338-da7ad0900002"
# 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/error-tracking/issues/${issue_id}/state" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"state": "RESOLVED"
},
"id": "c1726a66-1f64-11ee-b338-da7ad0900002",
"type": "error_tracking_issue"
}
}
EOF# Path parameters
export issue_id="c1726a66-1f64-11ee-b338-da7ad0900002"
# 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/error-tracking/issues/${issue_id}/state" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"state": "RESOLVED"
},
"id": "c1726a66-1f64-11ee-b338-da7ad0900002",
"type": "error_tracking_issue"
}
}
EOF# Path parameters
export issue_id="c1726a66-1f64-11ee-b338-da7ad0900002"
# 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/error-tracking/issues/${issue_id}/state" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"state": "RESOLVED"
},
"id": "c1726a66-1f64-11ee-b338-da7ad0900002",
"type": "error_tracking_issue"
}
}
EOF# Path parameters
export issue_id="c1726a66-1f64-11ee-b338-da7ad0900002"
# 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/error-tracking/issues/${issue_id}/state" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"state": "RESOLVED"
},
"id": "c1726a66-1f64-11ee-b338-da7ad0900002",
"type": "error_tracking_issue"
}
}
EOF# Path parameters
export issue_id="c1726a66-1f64-11ee-b338-da7ad0900002"
# 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/error-tracking/issues/${issue_id}/state" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"state": "RESOLVED"
},
"id": "c1726a66-1f64-11ee-b338-da7ad0900002",
"type": "error_tracking_issue"
}
}
EOF// Update the state of an issue returns "OK" 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"
)
func main() {
// there is a valid "issue" in the system
IssueID := os.Getenv("ISSUE_ID")
body := datadogV2.IssueUpdateStateRequest{
Data: datadogV2.IssueUpdateStateRequestData{
Attributes: datadogV2.IssueUpdateStateRequestDataAttributes{
State: datadogV2.ISSUESTATE_RESOLVED,
},
Id: IssueID,
Type: datadogV2.ISSUEUPDATESTATEREQUESTDATATYPE_ERROR_TRACKING_ISSUE,
},
}
ctx := datadog.NewDefaultContext(context.Background())
ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV2.NewErrorTrackingApi(apiClient)
resp, r, err := api.UpdateIssueState(ctx, IssueID, body)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ErrorTrackingApi.UpdateIssueState`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `ErrorTrackingApi.UpdateIssueState`:\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"// Update the state of an issue returns "OK" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.ErrorTrackingApi;
import com.datadog.api.client.v2.model.IssueResponse;
import com.datadog.api.client.v2.model.IssueState;
import com.datadog.api.client.v2.model.IssueUpdateStateRequest;
import com.datadog.api.client.v2.model.IssueUpdateStateRequestData;
import com.datadog.api.client.v2.model.IssueUpdateStateRequestDataAttributes;
import com.datadog.api.client.v2.model.IssueUpdateStateRequestDataType;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
ErrorTrackingApi apiInstance = new ErrorTrackingApi(defaultClient);
// there is a valid "issue" in the system
String ISSUE_ID = System.getenv("ISSUE_ID");
IssueUpdateStateRequest body =
new IssueUpdateStateRequest()
.data(
new IssueUpdateStateRequestData()
.attributes(
new IssueUpdateStateRequestDataAttributes().state(IssueState.RESOLVED))
.id(ISSUE_ID)
.type(IssueUpdateStateRequestDataType.ERROR_TRACKING_ISSUE));
try {
IssueResponse result = apiInstance.updateIssueState(ISSUE_ID, body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ErrorTrackingApi#updateIssueState");
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 the state of an issue returns "OK" response
"""
from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.error_tracking_api import ErrorTrackingApi
from datadog_api_client.v2.model.issue_state import IssueState
from datadog_api_client.v2.model.issue_update_state_request import IssueUpdateStateRequest
from datadog_api_client.v2.model.issue_update_state_request_data import IssueUpdateStateRequestData
from datadog_api_client.v2.model.issue_update_state_request_data_attributes import IssueUpdateStateRequestDataAttributes
from datadog_api_client.v2.model.issue_update_state_request_data_type import IssueUpdateStateRequestDataType
# there is a valid "issue" in the system
ISSUE_ID = environ["ISSUE_ID"]
body = IssueUpdateStateRequest(
data=IssueUpdateStateRequestData(
attributes=IssueUpdateStateRequestDataAttributes(
state=IssueState.RESOLVED,
),
id=ISSUE_ID,
type=IssueUpdateStateRequestDataType.ERROR_TRACKING_ISSUE,
),
)
configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
with ApiClient(configuration) as api_client:
api_instance = ErrorTrackingApi(api_client)
response = api_instance.update_issue_state(issue_id=ISSUE_ID, 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"# Update the state of an issue returns "OK" response
require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
end
api_instance = DatadogAPIClient::V2::ErrorTrackingAPI.new
# there is a valid "issue" in the system
ISSUE_ID = ENV["ISSUE_ID"]
body = DatadogAPIClient::V2::IssueUpdateStateRequest.new({
data: DatadogAPIClient::V2::IssueUpdateStateRequestData.new({
attributes: DatadogAPIClient::V2::IssueUpdateStateRequestDataAttributes.new({
state: DatadogAPIClient::V2::IssueState::RESOLVED,
}),
id: ISSUE_ID,
type: DatadogAPIClient::V2::IssueUpdateStateRequestDataType::ERROR_TRACKING_ISSUE,
}),
})
p api_instance.update_issue_state(ISSUE_ID, 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>" ruby "example.rb"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" ruby "example.rb"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" ruby "example.rb"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" ruby "example.rb"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" ruby "example.rb"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" ruby "example.rb"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" ruby "example.rb"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" ruby "example.rb"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" ruby "example.rb"// Update the state of an issue returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_error_tracking::ErrorTrackingAPI;
use datadog_api_client::datadogV2::model::IssueState;
use datadog_api_client::datadogV2::model::IssueUpdateStateRequest;
use datadog_api_client::datadogV2::model::IssueUpdateStateRequestData;
use datadog_api_client::datadogV2::model::IssueUpdateStateRequestDataAttributes;
use datadog_api_client::datadogV2::model::IssueUpdateStateRequestDataType;
#[tokio::main]
async fn main() {
// there is a valid "issue" in the system
let issue_id = std::env::var("ISSUE_ID").unwrap();
let body = IssueUpdateStateRequest::new(IssueUpdateStateRequestData::new(
IssueUpdateStateRequestDataAttributes::new(IssueState::RESOLVED),
issue_id.clone(),
IssueUpdateStateRequestDataType::ERROR_TRACKING_ISSUE,
));
let configuration = datadog::Configuration::new();
let api = ErrorTrackingAPI::with_config(configuration);
let resp = api.update_issue_state(issue_id.clone(), 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 the state of an issue returns "OK" response
*/
import { client, v2 } from "@datadog/datadog-api-client";
const configuration = client.createConfiguration({
authMethods: {
AuthZ: {
accessToken: process.env.DD_BEARER_TOKEN as string,
},
},
});
const apiInstance = new v2.ErrorTrackingApi(configuration);
// there is a valid "issue" in the system
const ISSUE_ID = process.env.ISSUE_ID as string;
const params: v2.ErrorTrackingApiUpdateIssueStateRequest = {
body: {
data: {
attributes: {
state: "RESOLVED",
},
id: ISSUE_ID,
type: "error_tracking_issue",
},
},
issueId: ISSUE_ID,
};
apiInstance
.updateIssueState(params)
.then((data: v2.IssueResponse) => {
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>" npx tsx "example.ts"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" npx tsx "example.ts"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" npx tsx "example.ts"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" npx tsx "example.ts"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" npx tsx "example.ts"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" npx tsx "example.ts"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" npx tsx "example.ts"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" npx tsx "example.ts"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" npx tsx "example.ts"