Update an incident todo
https://api.datadoghq.com/api/v2/incidents/{incident_id}/relationships/todos/{todo_id}https://api.us3.datadoghq.com/api/v2/incidents/{incident_id}/relationships/todos/{todo_id}https://api.us5.datadoghq.com/api/v2/incidents/{incident_id}/relationships/todos/{todo_id}https://api.datadoghq.eu/api/v2/incidents/{incident_id}/relationships/todos/{todo_id}https://api.ap1.datadoghq.com/api/v2/incidents/{incident_id}/relationships/todos/{todo_id}https://api.ap2.datadoghq.com/api/v2/incidents/{incident_id}/relationships/todos/{todo_id}https://api.uk1.datadoghq.com/api/v2/incidents/{incident_id}/relationships/todos/{todo_id}https://api.ddog-gov.com/api/v2/incidents/{incident_id}/relationships/todos/{todo_id}https://api.us2.ddog-gov.com/api/v2/incidents/{incident_id}/relationships/todos/{todo_id}Overview
Update an incident todo.
OAuth apps require the incident_write authorization scope to access this endpoint.
Arguments
Path Parameters
incident_id [required]The UUID of the incident.
todo_id [required]The UUID of the incident todo.
Request
Body Data (required)
Incident todo payload.
data [required]Incident todo data for a patch request.
attributes [required]Incident todo's attributes.
assignees [required]Array of todo assignees.
Object 1Assignee's @-handle.
Object 2Anonymous assignee entity.
icon [required]URL for assignee's icon.
id [required]Anonymous assignee's ID.
name [required]Assignee's name.
source [required]The source of the anonymous assignee.
slackslack, microsoft_teamscompletedTimestamp when the todo was completed.
content [required]The follow-up task's content.
due_dateTimestamp when the todo should be completed by.
incident_idUUID of the incident this todo is connected to.
type [required]Todo resource type.
incident_todosincident_todos{
"data": {
"attributes": {
"assignees": [
"@test.user@test.com"
],
"completed": "2023-03-06T22:00:00.000000+00:00",
"content": "Restore lost data.",
"due_date": "2023-07-10T05:00:00.000000+00:00",
"incident_id": "00000000-aaaa-0000-0000-000000000000"
},
"type": "incident_todos"
}
}Response
OK
Response with an incident todo.
data [required]Incident todo response data.
attributesIncident todo's attributes.
assignees [required]Array of todo assignees.
Object 1Assignee's @-handle.
Object 2Anonymous assignee entity.
icon [required]URL for assignee's icon.
id [required]Anonymous assignee's ID.
name [required]Assignee's name.
source [required]The source of the anonymous assignee.
slackslack, microsoft_teamscompletedTimestamp when the todo was completed.
content [required]The follow-up task's content.
createdTimestamp when the incident todo was created.
due_dateTimestamp when the todo should be completed by.
incident_idUUID of the incident this todo is connected to.
modifiedTimestamp when the incident todo was last modified.
id [required]The incident todo's ID.
relationshipsThe incident's relationships from a response.
created_by_userRelationship to user.
data [required]Relationship to user object.
id [required]A unique identifier that represents the user.
type [required]Users resource type.
usersuserslast_modified_by_userRelationship to user.
data [required]Relationship to user object.
id [required]A unique identifier that represents the user.
type [required]Users resource type.
usersuserstype [required]Todo resource type.
incident_todosincident_todosincludedIncluded related resources that the user requested.
<type=users>User object returned by the API.
attributesAttributes of user object returned by the API.
created_atThe ISO 8601 timestamp of when the user account was created.
disabledWhether the user account is deactivated. Disabled users cannot log in.
emailThe email address of the user, used for login and notifications.
handleThe unique handle (username) of the user, typically matching their email prefix.
iconURL of the user's profile icon, typically a Gravatar URL derived from the email address.
last_login_timeThe ISO 8601 timestamp of the user's most recent login, or null if the user has never logged in.
mfa_enabledWhether multi-factor authentication (MFA) is enabled for the user's account.
modified_atThe ISO 8601 timestamp of when the user account was last modified.
nameThe full display name of the user as shown in the Datadog UI.
service_accountWhether this is a service account rather than a human user. Service accounts are used for programmatic API access.
statusThe current status of the user account (for example, Active, Pending, or Disabled).
titleThe job title of the user (for example, "Senior Engineer" or "Product Manager").
uuidThe globally unique identifier (UUID) of the user.
verifiedWhether the user's email address has been verified.
idID of the user.
relationshipsRelationships of the user object returned by the API.
orgRelationship to an organization.
data [required]Relationship to organization object.
id [required]ID of the organization.
type [required]Organizations resource type.
orgsorgsother_orgsRelationship to organizations.
data [required]Relationships to organization objects.
id [required]ID of the organization.
type [required]Organizations resource type.
orgsorgsother_usersRelationship to users.
data [required]Relationships to user objects.
id [required]A unique identifier that represents the user.
type [required]Users resource type.
usersusersrolesRelationship to roles.
dataAn array containing type and the unique identifier of a role.
idThe unique identifier of the role.
typeRoles type.
rolesrolestypeUsers resource type.
usersusers{
"data": {
"attributes": {
"assignees": [
{
"description": "@test.user@test.com",
"example": "@test.user@test.com",
"type": "@test.user@test.com"
}
],
"completed": "2023-03-06T22:00:00.000000+00:00",
"content": "Restore lost data.",
"created": "2019-09-19T10:00:00.000Z",
"due_date": "2023-07-10T05:00:00.000000+00:00",
"incident_id": "00000000-aaaa-0000-0000-000000000000",
"modified": "2019-09-19T10:00:00.000Z"
},
"id": "00000000-0000-0000-1234-000000000000",
"relationships": {
"created_by_user": {
"data": {
"id": "00000000-0000-0000-2345-000000000000",
"type": "users"
}
},
"last_modified_by_user": {
"data": {
"id": "00000000-0000-0000-2345-000000000000",
"type": "users"
}
}
},
"type": "incident_todos"
},
"included": [
{
"attributes": {
"created_at": "2019-09-19T10:00:00.000Z",
"disabled": false,
"email": "string",
"handle": "string",
"icon": "string",
"last_login_time": "2019-09-19T10:00:00.000Z",
"mfa_enabled": false,
"modified_at": "2019-09-19T10:00:00.000Z",
"name": "string",
"service_account": false,
"status": "string",
"title": "string",
"uuid": "string",
"verified": false
},
"id": "string",
"relationships": {
"org": {
"data": {
"id": "00000000-0000-beef-0000-000000000000",
"type": "orgs"
}
},
"other_orgs": {
"data": [
{
"id": "00000000-0000-beef-0000-000000000000",
"type": "orgs"
}
]
},
"other_users": {
"data": [
{
"id": "00000000-0000-0000-2345-000000000000",
"type": "users"
}
]
},
"roles": {
"data": [
{
"id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
"type": "roles"
}
]
}
},
"type": "users"
}
]
}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"
]
}Code Example
# Path parameters
export incident_id="CHANGE_ME"
export todo_id="CHANGE_ME"
# 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 PATCH "https://api.${DD_SITE}/api/v2/incidents/${incident_id}/relationships/todos/${todo_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"assignees": [
"@test.user@test.com"
],
"completed": "2023-03-06T22:00:00.000000+00:00",
"content": "Restore lost data.",
"due_date": "2023-07-10T05:00:00.000000+00:00",
"incident_id": "00000000-aaaa-0000-0000-000000000000"
},
"type": "incident_todos"
}
}
EOF# Path parameters
export incident_id="CHANGE_ME"
export todo_id="CHANGE_ME"
# 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 PATCH "https://api.${DD_SITE}/api/v2/incidents/${incident_id}/relationships/todos/${todo_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"assignees": [
"@test.user@test.com"
],
"completed": "2023-03-06T22:00:00.000000+00:00",
"content": "Restore lost data.",
"due_date": "2023-07-10T05:00:00.000000+00:00",
"incident_id": "00000000-aaaa-0000-0000-000000000000"
},
"type": "incident_todos"
}
}
EOF# Path parameters
export incident_id="CHANGE_ME"
export todo_id="CHANGE_ME"
# 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 PATCH "https://api.${DD_SITE}/api/v2/incidents/${incident_id}/relationships/todos/${todo_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"assignees": [
"@test.user@test.com"
],
"completed": "2023-03-06T22:00:00.000000+00:00",
"content": "Restore lost data.",
"due_date": "2023-07-10T05:00:00.000000+00:00",
"incident_id": "00000000-aaaa-0000-0000-000000000000"
},
"type": "incident_todos"
}
}
EOF# Path parameters
export incident_id="CHANGE_ME"
export todo_id="CHANGE_ME"
# 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 PATCH "https://api.${DD_SITE}/api/v2/incidents/${incident_id}/relationships/todos/${todo_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"assignees": [
"@test.user@test.com"
],
"completed": "2023-03-06T22:00:00.000000+00:00",
"content": "Restore lost data.",
"due_date": "2023-07-10T05:00:00.000000+00:00",
"incident_id": "00000000-aaaa-0000-0000-000000000000"
},
"type": "incident_todos"
}
}
EOF# Path parameters
export incident_id="CHANGE_ME"
export todo_id="CHANGE_ME"
# 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 PATCH "https://api.${DD_SITE}/api/v2/incidents/${incident_id}/relationships/todos/${todo_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"assignees": [
"@test.user@test.com"
],
"completed": "2023-03-06T22:00:00.000000+00:00",
"content": "Restore lost data.",
"due_date": "2023-07-10T05:00:00.000000+00:00",
"incident_id": "00000000-aaaa-0000-0000-000000000000"
},
"type": "incident_todos"
}
}
EOF# Path parameters
export incident_id="CHANGE_ME"
export todo_id="CHANGE_ME"
# 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 PATCH "https://api.${DD_SITE}/api/v2/incidents/${incident_id}/relationships/todos/${todo_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"assignees": [
"@test.user@test.com"
],
"completed": "2023-03-06T22:00:00.000000+00:00",
"content": "Restore lost data.",
"due_date": "2023-07-10T05:00:00.000000+00:00",
"incident_id": "00000000-aaaa-0000-0000-000000000000"
},
"type": "incident_todos"
}
}
EOF# Path parameters
export incident_id="CHANGE_ME"
export todo_id="CHANGE_ME"
# 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 PATCH "https://api.${DD_SITE}/api/v2/incidents/${incident_id}/relationships/todos/${todo_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"assignees": [
"@test.user@test.com"
],
"completed": "2023-03-06T22:00:00.000000+00:00",
"content": "Restore lost data.",
"due_date": "2023-07-10T05:00:00.000000+00:00",
"incident_id": "00000000-aaaa-0000-0000-000000000000"
},
"type": "incident_todos"
}
}
EOF# Path parameters
export incident_id="CHANGE_ME"
export todo_id="CHANGE_ME"
# 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 PATCH "https://api.${DD_SITE}/api/v2/incidents/${incident_id}/relationships/todos/${todo_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"assignees": [
"@test.user@test.com"
],
"completed": "2023-03-06T22:00:00.000000+00:00",
"content": "Restore lost data.",
"due_date": "2023-07-10T05:00:00.000000+00:00",
"incident_id": "00000000-aaaa-0000-0000-000000000000"
},
"type": "incident_todos"
}
}
EOF# Path parameters
export incident_id="CHANGE_ME"
export todo_id="CHANGE_ME"
# 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 PATCH "https://api.${DD_SITE}/api/v2/incidents/${incident_id}/relationships/todos/${todo_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"assignees": [
"@test.user@test.com"
],
"completed": "2023-03-06T22:00:00.000000+00:00",
"content": "Restore lost data.",
"due_date": "2023-07-10T05:00:00.000000+00:00",
"incident_id": "00000000-aaaa-0000-0000-000000000000"
},
"type": "incident_todos"
}
}
EOF// Update an incident todo 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 "incident" in the system
IncidentDataID := os.Getenv("INCIDENT_DATA_ID")
// the "incident" has an "incident_todo"
IncidentTodoDataID := os.Getenv("INCIDENT_TODO_DATA_ID")
body := datadogV2.IncidentTodoPatchRequest{
Data: datadogV2.IncidentTodoPatchData{
Attributes: datadogV2.IncidentTodoAttributes{
Assignees: []datadogV2.IncidentTodoAssignee{
datadogV2.IncidentTodoAssignee{
IncidentTodoAssigneeHandle: datadog.PtrString("@test.user@test.com")},
},
Content: "Restore lost data.",
Completed: *datadog.NewNullableString(datadog.PtrString("2023-03-06T22:00:00.000000+00:00")),
DueDate: *datadog.NewNullableString(datadog.PtrString("2023-07-10T05:00:00.000000+00:00")),
},
Type: datadogV2.INCIDENTTODOTYPE_INCIDENT_TODOS,
},
}
ctx := datadog.NewDefaultContext(context.Background())
ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
configuration := datadog.NewConfiguration()
configuration.SetUnstableOperationEnabled("v2.UpdateIncidentTodo", true)
apiClient := datadog.NewAPIClient(configuration)
api := datadogV2.NewIncidentsApi(apiClient)
resp, r, err := api.UpdateIncidentTodo(ctx, IncidentDataID, IncidentTodoDataID, body)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `IncidentsApi.UpdateIncidentTodo`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `IncidentsApi.UpdateIncidentTodo`:\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 an incident todo returns "OK" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.IncidentsApi;
import com.datadog.api.client.v2.model.IncidentTodoAssignee;
import com.datadog.api.client.v2.model.IncidentTodoAttributes;
import com.datadog.api.client.v2.model.IncidentTodoPatchData;
import com.datadog.api.client.v2.model.IncidentTodoPatchRequest;
import com.datadog.api.client.v2.model.IncidentTodoResponse;
import com.datadog.api.client.v2.model.IncidentTodoType;
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.updateIncidentTodo", true);
IncidentsApi apiInstance = new IncidentsApi(defaultClient);
// there is a valid "incident" in the system
String INCIDENT_DATA_ID = System.getenv("INCIDENT_DATA_ID");
// the "incident" has an "incident_todo"
String INCIDENT_TODO_DATA_ID = System.getenv("INCIDENT_TODO_DATA_ID");
IncidentTodoPatchRequest body =
new IncidentTodoPatchRequest()
.data(
new IncidentTodoPatchData()
.attributes(
new IncidentTodoAttributes()
.assignees(
Collections.singletonList(
new IncidentTodoAssignee("@test.user@test.com")))
.content("Restore lost data.")
.completed("2023-03-06T22:00:00.000000+00:00")
.dueDate("2023-07-10T05:00:00.000000+00:00"))
.type(IncidentTodoType.INCIDENT_TODOS));
try {
IncidentTodoResponse result =
apiInstance.updateIncidentTodo(INCIDENT_DATA_ID, INCIDENT_TODO_DATA_ID, body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling IncidentsApi#updateIncidentTodo");
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 an incident todo returns "OK" response
"""
from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.incidents_api import IncidentsApi
from datadog_api_client.v2.model.incident_todo_assignee_array import IncidentTodoAssigneeArray
from datadog_api_client.v2.model.incident_todo_attributes import IncidentTodoAttributes
from datadog_api_client.v2.model.incident_todo_patch_data import IncidentTodoPatchData
from datadog_api_client.v2.model.incident_todo_patch_request import IncidentTodoPatchRequest
from datadog_api_client.v2.model.incident_todo_type import IncidentTodoType
# there is a valid "incident" in the system
INCIDENT_DATA_ID = environ["INCIDENT_DATA_ID"]
# the "incident" has an "incident_todo"
INCIDENT_TODO_DATA_ID = environ["INCIDENT_TODO_DATA_ID"]
body = IncidentTodoPatchRequest(
data=IncidentTodoPatchData(
attributes=IncidentTodoAttributes(
assignees=IncidentTodoAssigneeArray(
[
"@test.user@test.com",
]
),
content="Restore lost data.",
completed="2023-03-06T22:00:00.000000+00:00",
due_date="2023-07-10T05:00:00.000000+00:00",
),
type=IncidentTodoType.INCIDENT_TODOS,
),
)
configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
configuration.unstable_operations["update_incident_todo"] = True
with ApiClient(configuration) as api_client:
api_instance = IncidentsApi(api_client)
response = api_instance.update_incident_todo(incident_id=INCIDENT_DATA_ID, todo_id=INCIDENT_TODO_DATA_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 an incident todo returns "OK" response
require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
config.unstable_operations["v2.update_incident_todo".to_sym] = true
end
api_instance = DatadogAPIClient::V2::IncidentsAPI.new
# there is a valid "incident" in the system
INCIDENT_DATA_ID = ENV["INCIDENT_DATA_ID"]
# the "incident" has an "incident_todo"
INCIDENT_TODO_DATA_ID = ENV["INCIDENT_TODO_DATA_ID"]
body = DatadogAPIClient::V2::IncidentTodoPatchRequest.new({
data: DatadogAPIClient::V2::IncidentTodoPatchData.new({
attributes: DatadogAPIClient::V2::IncidentTodoAttributes.new({
assignees: [
"@test.user@test.com",
],
content: "Restore lost data.",
completed: "2023-03-06T22:00:00.000000+00:00",
due_date: "2023-07-10T05:00:00.000000+00:00",
}),
type: DatadogAPIClient::V2::IncidentTodoType::INCIDENT_TODOS,
}),
})
p api_instance.update_incident_todo(INCIDENT_DATA_ID, INCIDENT_TODO_DATA_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>" 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 an incident todo returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_incidents::IncidentsAPI;
use datadog_api_client::datadogV2::model::IncidentTodoAssignee;
use datadog_api_client::datadogV2::model::IncidentTodoAttributes;
use datadog_api_client::datadogV2::model::IncidentTodoPatchData;
use datadog_api_client::datadogV2::model::IncidentTodoPatchRequest;
use datadog_api_client::datadogV2::model::IncidentTodoType;
#[tokio::main]
async fn main() {
// there is a valid "incident" in the system
let incident_data_id = std::env::var("INCIDENT_DATA_ID").unwrap();
// the "incident" has an "incident_todo"
let incident_todo_data_id = std::env::var("INCIDENT_TODO_DATA_ID").unwrap();
let body = IncidentTodoPatchRequest::new(IncidentTodoPatchData::new(
IncidentTodoAttributes::new(
vec![IncidentTodoAssignee::IncidentTodoAssigneeHandle(
"@test.user@test.com".to_string(),
)],
"Restore lost data.".to_string(),
)
.completed(Some("2023-03-06T22:00:00.000000+00:00".to_string()))
.due_date(Some("2023-07-10T05:00:00.000000+00:00".to_string())),
IncidentTodoType::INCIDENT_TODOS,
));
let mut configuration = datadog::Configuration::new();
configuration.set_unstable_operation_enabled("v2.update_incident_todo", true);
let api = IncidentsAPI::with_config(configuration);
let resp = api
.update_incident_todo(
incident_data_id.clone(),
incident_todo_data_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 an incident todo 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,
},
},
});
configuration.unstableOperations["v2.updateIncidentTodo"] = true;
const apiInstance = new v2.IncidentsApi(configuration);
// there is a valid "incident" in the system
const INCIDENT_DATA_ID = process.env.INCIDENT_DATA_ID as string;
// the "incident" has an "incident_todo"
const INCIDENT_TODO_DATA_ID = process.env.INCIDENT_TODO_DATA_ID as string;
const params: v2.IncidentsApiUpdateIncidentTodoRequest = {
body: {
data: {
attributes: {
assignees: ["@test.user@test.com"],
content: "Restore lost data.",
completed: "2023-03-06T22:00:00.000000+00:00",
dueDate: "2023-07-10T05:00:00.000000+00:00",
},
type: "incident_todos",
},
},
incidentId: INCIDENT_DATA_ID,
todoId: INCIDENT_TODO_DATA_ID,
};
apiInstance
.updateIncidentTodo(params)
.then((data: v2.IncidentTodoResponse) => {
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"